For Programmers: Free Programming Magazines  


Home > Archive > AWK > October 2006 > Re: match pattern but print previous line









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: match pattern but print previous line
Pad

2006-10-12, 6:57 pm


>
> If you don't mind a trailing semicolon it's just:
>
> gsub(/[0-9][0-9]/,"&:")
>
>

Thanks Ed. I can take away the traling ':' with
cut cmd. But if I use the gsub cmd as per your suggestion , i get
syntax error.

echo 20000000c93b1cdc | awk '{ gsub (/[0-9][0-9]/,"&:") }'
awk: syntax error near line 1
awk: illegal statement near line 1

Thanks
pad

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com