SUMMARY: Sorting

From: Mohammad Matar (
Date: Tue Jul 18 2000 - 16:05:07 CDT

It is always good to think simple at first, the solution was
# sort -t, -k 2,2n -k 3,3nr filename
thanks to Mark Scarborough among others.

the original post was:
I have this situation: an acsii file with comma separated fields that I need
> to sort in this fashion:
> 2nd field ascending order
> 3rd filed descending order
> These fields are numbers. I tried using sort but after sorting the 2nd
> and then trying to sort the 3rd filed I would loose the order of the 2nd
> filed! Then I realized that sort acts on lines although you can specify
> filed to be your key. I do not have much experience with shell scripting,
> would any one have quick idea to do this? Thanks.

Mohammad Matar
Systems Engineer
Digital Controls Corp.
(513) 746-8118 ext. 2205
(513) 743-8575 fax

U BEFORE POSTING please READ the FAQ located at
. and the list POLICY statement located at
A To submit questions/summaries to this list send your email message to:
A To unsubscribe from this list please send an email message to:
E and in the BODY type:
R unsubscribe sun-managers
S Or
. unsubscribe sun-managers original@subscription.address
L To view an archive of this list please visit:

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:12 CDT