How to sort a file in unix both alphabetically and numerically on different fields?
问题 Please don't think this is a repeat of the "Sorting alphanumeric data in unix" question... I looked at the other answers, and think my case is a bit different! I have data like this: A 192 D 112 D 188 C 091 A 281 B 919 ...And I want to sort first column 1 (alphabetically), and then by column 2 (numerically). I tried using: sort -n -k1,2 ...But this gave me correctly sorted for the first field, but then the wrong sorting for the second field (1000,1002,1003,10,1 ... instead of 1,10,1000,1002