我使用 vi 创建并编辑了一个名为 sort.txt 的文件,如下所示:
sentence one
sentence two
sentence one
sentence three
sentence two
sentence two
sentence three
sentence one
sentence two
sentence one
sentence one
sentence one
sentence three
sentence four
sentence five
当我这样做时,sort sort.txt | uniq -c
我得到了这个:
1 sentence five
1 sentence four
5 sentence one
1 sentence one
3 sentence three
4 sentence two
另外,当我写的时候sort sort.txt | uniq -u
,“sentence one”也出现在那里。我不明白为什么“句子一”出现两次,好像内容不同,有人可以解释为什么吗?
您在第一个末尾有尾随空格
sentence one
: