[thelist] Basic GREP help
Jay Blanchard
jay.blanchard at niicommunications.com
Fri Jan 14 08:55:35 CST 2005
[snip]
Could someone help me out with this basic GREP problem ?
I have a list of items ... Each on it¹s own line....
(Here¹s a example of part of the list)
7322 - Adjustment & collection services
7323 - Credit reporting services
7334 - Photocopying services
7336 - Commercial art / graphic design
7338 - Secretarial services
7350 - Miscellaneous equipment rental
I need to transform that list into this ..
7322 (a) 7322 (b) 7322 - Adjustment & collection services
7323 (a) 7323 (b) 7323 - Credit reporting services
7334 (a) 7334 (b) 7334 - Photocopying services
Etc ...
(take the 4 digit code and ³pasting it twice at the start of the line with
the delineator between)
What would be a GREP search pattern that would do this ?
[/snip]
Better with awk...
cat test.txt | awk '/73/ {print $1 " (a) " $1 " (b) "$0}'
More information about the thelist
mailing list