I need to sort a file on the first character in the 4th field, then the
third field then the 2nd field.
I used
sort -y -k 4.1,4.1 -k 3,3 -k 2,2n
but I don't get the proper sort on the first character
example data
1213 1995031311483766 00000000 CX8440 0033105 10140Q0 1000 35.2
1313 1995031311483766 00000000 CX8440 0033105 10140Q0 2000 33.2
1413 1995031311483766 00000000 CX8440 0033105 10140Q0 2000 38.5
1513 1995031311483766 00000000 CX8440 0033105 10140Q0 2000 25.2
1613 1995031311483766 00000000 CX8440 0033105 10140Q0 3000 35.2
2310 1997031109572954 00000000 MX7960 9700088 20078Q0 1000 52.5
2310 1997031109572954 00000000 MX7960 9700088 20078Q0 2000 61.5
2310 1997031109572954 00000000 MX7960 9700088 20078Q0 2000 62.5
2501 1997031109584497 00000000 MX7960 9700088 20119T0 1000 56
2501 1997031109584497 00000000 MX7960 9700088 20119T0 1000 56
1313 1998111511575346 00000000 CX8440 0033000 40027Q0 3000 23.3
1313 1998111911594098 00000000 CX8440 0033000 90169Q0 1500 22.5
1313 1998122711594032 00000000 CX8440 0033000 90111Q0 2000 26.5
1313 1998122711594032 00000000 CX8440 0033000 90111Q0 3600 22.5
2302 1994010710525257 0000000000 CX5380 0141684 20030Q0 1000 60
2302 1994010710525257 0000000000 CX5380 0141684 20030Q0 1000 60
2302 1994010710525257 0000000000 CX5380 0141684 20030Q0 1000 60
This sample comes out exactly as it goes in, when I really want all the
'C's sorted
before all the 'M' in the fourth field. I must be missing something,
but I haven't been
able to come up with it. Is the multiple spaces between the 3rd and 4th
fields messing this up?
(not according to man sort: "The default field separator is one or more
spaces.")
thanks