Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
考虑排序键:a、a01 和 a02,如果没有尾随字段,排序结果如下所示:
$ cat test1 a01 a a02 $ sort test1 a a01 a02 $
但是如果有尾矿场,事情就会变得奇怪:
$ cat test2 a01 7 a 12 a02 42 $ sort test2 a01 7 a02 42 a 12 $
为什么键“a”从排序结果的顶部落到底部?
我的排序版本是“排序(GNU coreutils)5.97”。
我的版本的手册页sort说:
sort
*** WARNING *** The locale specified by the environment affects sort order. Set LC_ALL=C to get the traditional sort order that uses native byte values.
事实上,如果我设置LC_ALL=C并运行sort您的第二个示例,我会得到:
LC_ALL=C
$ LC_ALL=C sort < tosort a 12 a01 7 a02 42
您的默认位置可能不是C.
C