Can I use GNU sort to sort one field in order, another in reverse?
My file looks like this:
Ann 6
John 5
Betty 5
I want it to look like this:
Ann 6
Betty 5
John 5
If I use 'sort -r -k2 -k1' or even 'sort -rk2 -k1', I get:
Ann 6
John 5
Betty 5
because it sorts /all/ fields in reverse. I only want to sort k2 (the second field) in reverse, but when I have to sort based on k1 (the first field--that is, when the second field is a tie) I want to sort the first field in order, not reverse order.
Can anyone help? Or is this not possible using GNU sort?
|