Results 1 to 2 of 2
I need to take a file, put a certain field in ABC order and number each line.
After that is finished I need to return the file to it's original ...
- 12-04-2006 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 2
Sort command help
I need to take a file, put a certain field in ABC order and number each line.
After that is finished I need to return the file to it's original order with the numbered field added.
I am told I need to use sort and gawk.
I have this so far
awk '{printf("%5d : %s\n", NR,$0)}' to put the number on each line.
Anyone help me out?
- 12-18-2006 #2Linux User
- Join Date
- Jun 2006
- Posts
- 311
Hi millhouze,
This sure looks like a homework.
Read the man page of sort and the following webpages on gawk/awk to "sort it out" : -
http://hal.csd.auth.gr/thelug/faqs/gawk.html
http://www.cs.hmc.edu/qref/awk.html
With Regards,
Thinker


Reply With Quote