Next: , Previous: , Up: Implementation Details   [Contents][Index]


30.2.4 Punctuation Characters vs letters

Rule 2.2.1 dictates that letters sorts earlier than all non-letters (after breaking down a string to digits and non-digits parts).

$ cat input6
a%
az

$ sort -V input6
az
a%

The input strings consist entirely of non-digits, and based on the above algorithm have only one part, all non-digit characters (‘a%’ vs ‘az’).

Each part is then compared lexically, character-by-character. ‘a’ compares identically in both strings.

Rule 2.2.1 dictates that letters (‘z’) sorts earlier than all non-letters (‘%’) - hence ‘az’ appears first (despite ‘z’ having ASCII value of 122, much bigger than ‘%’ with ASCII value 37).