Got a question, when I apply sort command line in linux to sort some domain names by dictionary order, no matter which option i used, it will sort some domains like this:
...
abca.com
abc-d.com
abce.com
...
I am curious what comparison function it applys in its' sorting function. I supposed it should be a string comparison, like strcmp function, but it is not. coz strcmp will compare ascii code of characters in string one by one, thus above sorting should like this:
abc-d.com
abca.com
abce.com
one guess is that when sorting names the special characters like "." "-" will be skipped. but still got some problem when sorting following names:
abc---d.com
abc--d.com
abc-d.com
why can linux sorting keep this order? if it skips some special characters, above names should be compared equally and maybe sorted as a random order.
confused, anybody has thought about that?
-----
p.s.
Haven't got updated here for quite a long time, coz I am back to program with c under linux and I believe it is a place for Java programmers.
-----
update:
Linux sorting compares unicode of strings … more about unicode is here