Why does 'sort' ignore special characters, like the asterisk?

Solution 1:

sort --version-sort filename 

This preserves the natural order of numbers.

Solution 2:

Setting LC_ALL=C restored the traditional sorting order in my case. Package: coreutils Version: 8.5-1ubuntu3

export LC_ALL=C 

Solution 3:

Version: sort (GNU coreutils) 8.26

I do it inline:

LANG=C sort FILE

Or by function (changes the original file):

dosort() { local file="$*"; LANG=C sort ${file} -o ${file}.swp; mv ${file}.swp ${file}; cat ${file} ;}