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


> I see with surprise that standard sed wants the new lines,
> at least it wants
>
> sed -n -e '/pattern/{x;p;}' -e 'h'
>
> only Gnu sed takes
>
> sed -n '/pattern/{x;p;};h'
>
> ?


Thank you everyone for sed and awk response. I went with awk reponse as
it was easier for me to understand. As a totally unrelated question,
could you help me with the problem?
I would like to convert some even numbered string say 000102030405 to
00:01:02:03:04:05 etc. I gave 00, 01 as an example but the real string
would some look like 1000acdefe..(16 digits)

Thanks
Pad

Sponsored Links







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

Copyright 2008 codecomments.com