[CLUE-Tech] sort puzzler
Jeff Cann
j.cann at isuma.org
Wed Oct 22 20:00:50 MDT 2003
Greetings.
A colleague asked me about whether this problem can be solved with UNIX sort.
I'm could not think of a way from the shell to solve this problem. I told
her I would ask my 'guru' list on clue-tech.
Thanks,
Jeff
-----Original Message-----
Sent: Wednesday, October 22, 2003 1:26 PM
To: Cann, Jeffery
Subject: unix sort
Jeff,
I need to sort a file with columns 1-3 sorted ascending, column 4 descending.
I cannot get any combinations of the unix sort command to output this, so I
think I need to move to another approach such as perl or awk.
I can sort on key 4 to get that in descending order with sort -rn -t \| -k 4
But I cannot work the combination of sorts...
$ sort -t \| +1 -3 test.ibm
IBSALQAVC|006066|01|-1|20065|20065
IBSALQAVC|006066|01|-2|23684|23684
IBSALQAVC|006066|01|-3|19821|19821
IBSALQAVC|006066|01|-7|20428|20428
IBSALQAVC|006066|01|0|21631|21631
IBSALQAVC|006066|02|-1|20065|20065
IBSALQAVC|006066|02|-2|23684|23684
IBSALQAVC|006066|02|-3|19821|19821
IBSALQAVC|006066|02|-7|20428|20428
IBSALQAVC|006066|02|0|21631|21631
More information about the clue-tech
mailing list