sort command
Hi,
I want to sort a file contains 9 1 9 2 10 1 10 2 to the order of 10 1 9 1 10 2 9 2 That is, the 2nd column is in incremental order, but for lines with the same 2nd column number, they are sorted in a reversed order. I tried Sort –k2 –k1 –n –r But got everything in reversed order 10 2 9 2 10 1 9 1 Is there any simple way that works? Right now, I have to write a script to process this. Thanks, |
Sure is
sort -k2,2n -k1,1nr |
Code:
sort -k2n -k1nr file |
Great, thanks for both of you!!!
|
All times are GMT -5. The time now is 08:07 PM. |