help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sort fails to sort reverse columns


From: bastiaannaber
Subject: sort fails to sort reverse columns
Date: 21 Jun 2005 05:54:46 -0700
User-agent: G2/0.2

Hi,

I have a problem with the GNU sort command. For example: I have the
following text file (sort.txt):

1,2,1
3,3,2
4,1,1
1,2,2
2,1,2

I want to sort on column 2 and then on column 1. I type the following
command:

sort -t, -k2n -k1n sort.txt

However this gives as output:

4,1,1
2,1,2
1,2,1
1,2,2
3,3,2

Which is wrong because I would like to have it like this:

2,1,2
4,1,1
1,2,1
1,2,2
3,3,2

Does anyone know what I can do to achieve this result ?

Thanks in advance,
Bastiaan Naber



reply via email to

[Prev in Thread] Current Thread [Next in Thread]