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


> Don't use the old version of awk.
>
> If on solaris, use nawk or /usr/xpg4/bin/awk.


oh.. thank you/ I am using solaris8 OS. It works as Ed suggested.

/usr/xpg4/bin/awk '{ gsub (/[0-9a-z][0-9a-z]/,"&:" );print }' /tmp/x
20:00:00:00:c9:3b:1c:dc:

Since it is a fixed length string, I can use cut to remove trailing ':'

Pad

Sponsored Links







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

Copyright 2008 codecomments.com