1
Given a few files in a directory data
the following ls command provides a surprising result in the sense of how they are ordered:
for f in data/*; do echo $f; done
data/CitiesBaselineCounts2015010520150112.49.csv
data/CitiesBaselineCounts2015010520150112.4.csv
data/CitiesBaselineCounts2015010520150112.50.csv
data/CitiesBaselineCounts2015010520150112.5.csv
data/CitiesBaselineCounts2015010520150112.6.csv
data/CitiesBaselineCounts2015010520150112.7.csv
data/CitiesBaselineCounts2015010520150112.8.csv
data/CitiesBaselineCounts2015010520150112.9.csv
data/CitiesBaselineCounts2015010520150112.csv
The .
character is ascii 46- which precedes the codes for all of the digits (48 to 57).
So then the ordering is not lexicographical. What are the rules for the sorting used by the ls
command?
List files sorted numerically – DavidPostill – 2015-08-15T18:10:48.283
@DavidPostill Ok that's also helpful (and I will use it for this case) - but does not directly answer the lexicographical ordering. – javadba – 2015-08-15T19:23:07.613