Linux中用sort命令进行英文字母排序

2025-03-03 05:25:49
推荐回答(2个)
回答1:

跟locale有关。
man 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.
-----------------------------------------------------------------------------------
测试:
$locale
......
LC_ALL=zh_CN.GB18030
$sort test.sort
然后:
$export LC_ALL=C
$sort test.sort

回答2:

不会