SUMMARY: Sorting

From: Mohammad Matar (Matar@DigitalControls.com)
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
filed
> 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
what
> 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.
matar@DigitalControls.com
(513) 746-8118 ext. 2205
(513) 743-8575 fax

S
U BEFORE POSTING please READ the FAQ located at
N ftp://ftp.cs.toronto.edu/pub/jdd/sun-managers/faq
. and the list POLICY statement located at
M ftp://ftp.cs.toronto.edu/pub/jdd/sun-managers/policy
A To submit questions/summaries to this list send your email message to:
N sun-managers@ececs.uc.edu
A To unsubscribe from this list please send an email message to:
G majordomo@sunmanagers.ececs.uc.edu
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:
I http://www.latech.edu/sunman.html
S
T



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