小编evb*_*evb的帖子

在 unicode 文本上使用 uniq

我想从带有叙利亚文字的文件中删除重复的行。源文件有 3 行,第 1 行和第 3 行相同。

$ cat file.txt 
????
????
????
Run Code Online (Sandbox Code Playgroud)

当我使用sortand 时uniq,结果假定所有 3 行都相同,这是错误的:

$ cat file.txt | sort | uniq -c
      3 ????
Run Code Online (Sandbox Code Playgroud)

将语言环境显式设置为叙利亚语也无济于事。

$ LC_COLLATE=syr_SY.utf8 cat file.txt | sort | uniq -c      
     3 ????
Run Code Online (Sandbox Code Playgroud)

为什么会这样?如果重要的话,我正在使用 Kubuntu 18 和 bash。

sort unicode uniq

5
推荐指数
2
解决办法
1120
查看次数

标签 统计

sort ×1

unicode ×1

uniq ×1