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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort question

Status
Not open for further replies.

pjb

Programmer
May 1, 2001
148
US
I have a multi field record delimited by pipes (|). I have to sort by the 11th filed ascending, 32nd field descending, and the 30th field ascending.
 
man sort (the -t and -k options).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, had to do a little testing on the -k as what I needed was nowhaere on the man page. Here is what I came up with. It seems to work

sort -t'|' -k 11,11 -k 32r,32r -k 30,30

This allowed me to sort field 11 and 30 ascending, and field 32 descending
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top