You are not logged in.
Hey
I am having a little prolem with sort. I want to sort a file like that:
1 10 0
1 10 0
1 100 0
1 100 5
1 101 0
1 101 2
1 102 0
1 102 0
1 103 0
2 103 0
1 104 0
1 11 0
1 11 0
1 12 0
1 12 0
so it would look like that:
1 10 0
1 10 0
1 11 0
1 11 0
1 12 0
1 12 0
1 100 0
1 100 5
1 101 0
1 101 2
1 102 0
1 102 0
1 103 0
1 104 0
2 103 0
But, when I sort it with
sort -k 1n,2n file
or
sort -g -k 1,2 file
I always get
1 10 0
1 10 0
1 100 0
1 100 5
1 101 0
1 101 2
1 102 0
1 102 0
1 103 0
1 104 0
1 11 0
1 11 0
1 12 0
1 12 0
2 103 0
Is there a simple solution?
Regards
nsb
Last edited by nsb (2011-08-08 09:57:49)
Offline
I think the right options should be
sort -k1,1n -k2,2n file
You can use the --debug option of sort to see what's happening.
Offline
Thank you! That worked!
nsb
Offline