如何在linux中使用hangul字符对文件进行排序?

Lun*_*lpo 1 linux sorting unicode

我有包含许多hangul字符的文件.例如:

?
?
?
?
?

?
?
?
?
?
?
Run Code Online (Sandbox Code Playgroud)

我想使用linux排序来排序文件中的行,但排序不起作用.它给了我:

?
?
?
?
?
?
?
?
?
?
?
Run Code Online (Sandbox Code Playgroud)

因此,sort只对空格进行排序.怎么排序呢?

swp*_*wpd 5

这与系统的LANG环境变量有关.

为了对hangul字符进行排序,LANG应设置为ko_KR.utf-8.

LANG=ko_KR.utf-8 sort tmp.txt

应该适合您的需要:

?
?
?
?
?
?
?
?
?
?
?
Run Code Online (Sandbox Code Playgroud)

:d