The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 11-19-2008
rubin's Avatar
rubin rubin is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2007
Posts: 321
Quote:
Originally Posted by lost View Post
...
And even better sorted this way:
Code:
306 85
307 81,85
309 82,78,81
311 78
Then I have to repeat it for 70+ files.
Hope it makes sense now.
Thanks for replying.

Code:
awk '{printf ($2 in a) ? ","$5 : (NR>1) ? RS $2 FS $5 : $2 FS $5; a[$2]} END{print e}' file

Output:

Code:
306 85
307 81,85
309 82,78,81
311 78
Then you can use a for loop or find+while loop for all of your files.