Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting help

Status
Not open for further replies.

ryanc2

MIS
Apr 18, 2003
73
US
I'm having problems sorting a comma delimited file by the third column. This column is numeric and will contain numbers 1-99 (no leading zero for numbers 1-9)and will never start at the same position every time. I've tried using several of the options from the man page, but am struggling with the syntax to get what I want.

The input file could be as follows:

00010,blah,1
01234,blah blah blah,10
03415,blah blah,63

Thanks in advance.
 
Depending the flavor of your *nix try this:
Code:
sort -t ',' -n +3 -2
or:
Code:
sort -t ',' -k 3n,3

Hope This Help
PH.
 
The second option with the -k switch did it.

Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top