Domanda

Ho bisogno di ordinare alcuni file contenenti stringhe cinesi usando zh_CN.utf8 mentre il mio sistema è in en_US.utf8.

ad esempio ho test.csv:

4001,动词,動詞,dong4ci2
4000,不然,不然,bu4ran2
3999,规格,規格,gui1ge2
3998,抽出,抽出,chou1chu1
3997,浮水印,浮水印,fu2shui3yin4
3996,拖曳與贴上,拖曳與貼上,tuo1ye4yu3tie1shang4
3995,云端运算,雲端運算,yun2duan1yun4suan4
3994,字集,字集,zi4ji2
3993,内码,內碼,nei4ma3
3992,兼容,兼容,jian1rong2
.

Sto cercando di ordinare simplified chinese, I.e. 2 ° campo, come segue:

sort -t ',' -d -k 2 test.csv
.

Allora, come dovrei specificare un locale solo per il sort?

È stato utile?

Soluzione

Imposta LC_ALL temporaneamente come questo:

LC_ALL=zh_CN.utf8 sort -t ',' -d -k 2 test.csv
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top