我有以下根據 Excel 排序的文件清單:
a1.txt
a10.txt
a11.txt
a12.txt
a2.txt
如果我sort
在 Unix/Linux 上使用,我會得到以下命令:
a10.txt
a11.txt
a12.txt
a1.txt
a2.txt
您可以在其中看到角色的不同行為.
。是否可以選擇獲得與 Excel 相同的訂單?我嘗試了-b,-g,-n,...但沒有成功。
答案1
env LC_ALL=C sort
從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.
答案2
嘗試以下命令: sort -d
;)