我在探索 bash 时进入了一个级别,该级别包括查找在某个文件中仅出现一次的文本行。
为什么sort -u file命令的输出与 的输出不同sort file| uniq -u?他们不应该是一样的吗?
我想从带有叙利亚文字的文件中删除重复的行。源文件有 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。