I have a file that contains two columns separated by tab.
A10 A10_motorway_(Switzerland)
A-10 A-10_N/AW
A10 A10_Networks
A-10 A-10_road
A10 A10_road
A10_road_(California) A10_road_(Canada)
A10_road_(Croatia) A10_road_(disambiguation)
A10_road_(England) A10_road_(Great_Britain)
A10_road_(Isle_of_Man) A10_road_(Isle_of_Man)
A10_road_(Latvia) A10_road_(Malaysia)
A10_road_(United_Kingdom) A10_road_(United_States_of_America)
A10_road_(USA) A10_road_(Zimbabwe)
A-10 A-10_Shrike
A10 A10_(Switzerland)
I want to sort this file by the first column in alphabetical order. So the same titles should appear consecutively.
So I did this:
sort -t $'\t' -k1 -d filename
But the result is actually the snapshot above. As you see, entries "A-10" are not ordered and do not happen consecutively. I don't really care about the alphabetical order per se, but I want the same titles occurring consecutively. Could anyone explain why sort doesn't allow me to do this and how to fix this problem? Thanks!