Hi all,
I've got a file that has lines likes this:
2 123456789 0501 A B
The primary key to sort on is the 123456789 and the secondary sort key is the 0501 (year/month).
My current sort command is this:
sort +1n -2 +2n -3 ${file}.stripped > ${file}.sorted
A problem exists though, when you encounter a record that has a space in the part. It does the secondary sort incorrectly. Below is an example of what the sort does on 2 identical records but the date is different in both.
2 123456789 0501 A B
2 123456789 0401 A B
Note how the 0401 part should be above the 0501.
Can someone help? Thanks so much.
I've got a file that has lines likes this:
2 123456789 0501 A B
The primary key to sort on is the 123456789 and the secondary sort key is the 0501 (year/month).
My current sort command is this:
sort +1n -2 +2n -3 ${file}.stripped > ${file}.sorted
A problem exists though, when you encounter a record that has a space in the part. It does the secondary sort incorrectly. Below is an example of what the sort does on 2 identical records but the date is different in both.
2 123456789 0501 A B
2 123456789 0401 A B
Note how the 0401 part should be above the 0501.
Can someone help? Thanks so much.