[TriLUG] `sort` two field text file by second field

Jeff Bollinger jeff01 at email.unc.edu
Wed Mar 24 15:23:33 EST 2004


Can anyone tell me how to run 'sort' against a text file with two fields 
that's delimited?  For example:

I have a file in this format

text:3
text:1
text:2
text:14

etc...

The man page for 'sort' indicates the ability to use a field separator 
(-n) but I tried:

cat filename |sort -rn -t : |more

and that just sorts by the first column...

Thanks!
Jeff




More information about the TriLUG mailing list