sorting rows/lines in multiple level
Hi,
I am trying to sort a text file that has three columns on all the columns (first and two columns in ascending order and the third column with numbers in descensing order - smallest number first)
For example, the input file:
one a 12
two a -15
two a -8
three b 5
four b 2
four c -3
four c -8
should be outputted as:
four b 2
four c -8
four c -3
one a 12
three b 5
two a -15
two a -8
I tried to search online but I couldnt get this to work. This is the last thing I tried:
sort -k1,1 -k2,2 -nrk3, 3 in.txt > out.txt
Any help will be greatly appreciated!
Thanks.
|