For Programmers: Free Programming Magazines  


Home > Archive > AWK > September 2004 > format change









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 format change
moggces

2004-09-17, 3:56 am

Dear all,
I have a file like this
0 N3:A131:OG
0 O5:A131:HG
2 N3:A131:OG
3 N3:A131:OG
5 N3:A131:OG
6 N19:A131:OG
7 S21:A105:HD22
8 N2:A131:OG
8 O7:A131:HG

and I would like to change to
0 N3:A131:OG O5:A131:HG
2 N3:A131:OG
3 N3:A131:OG
5 N3:A131:OG
6 N19:A131:OG
7 S21:A105:HD22
8 N2:A131:OG O7:A131:HG

Do anybody have any idea?
Thank you very much.
Ulrich M. Schwarz

2004-09-17, 8:55 am

juihuahsieh@nhri.org.tw (moggces) writes:

> Dear all,
> I have a file like this

[...]
> and I would like to change to

[...]

1 {stuff[$1] = stuff[$1] " " $2; if ($1 > max) max = $1;}
END {for (foo=0; foo<=max; ++foo) if (foo in stuff) print foo,stuff[foo];}

HTH
Ulrich
--
"Reinigungsbenzin? Das nehmen doch die in der Reinigung..."
Sponsored Links







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

Copyright 2008 codecomments.com