Gnu/coreutils/Version-sort-overview
From Get docs
Next: Implementation Details, Up: Version sort ordering [Contents][Index]
30.1 Version sort overview
version sort ordering (and similarly, natural sort ordering) is a method to sort items such as file names and lines of text in an order that feels more natural to people, when the text contains a mixture of letters and digits.
Standard sorting usually does not produce the order that one expects because comparisons are made on a character-by-character basis.
Compare the sorting of the following items:
Alphabetical sort: Version Sort: a1 a1 a120 a2 a13 a13 a2 a120
version sort functionality in GNU coreutils is available in the ‘ls -v
’,
‘ls --sort=version
’, ‘sort -V
’, ‘sort --version-sort
’ commands.
• Using version sort in GNU coreutils | ||
• Origin of version sort and differences from natural sort | ||
• Correct/Incorrect ordering and Expected/Unexpected results |