Mac 上的奇怪 uniq 输出

strange uniq output on Mac

这是输入文件和输出文件,我觉得像c和g这样的字符不应该输出?

$ uniq c.txt
a
g
b
g
c
v
c
$ cat c.txt
a
g
b
b
g
g
c
v
c

提前致谢, 林

来自uniq man page

Repeated lines in the input will not be detected if they are not adjacent, so it may be necessary to sort the files first.

macbook:Whosebug joeyoung$ cat c.txt
a
g
b
b
g
g
c
v
c
macbook:Whosebug joeyoung$ uniq c.txt
a
g
b
g
c
v
c
macbook:Whosebug joeyoung$ sort -u c.txt
a
b
c
g
v
macbook:Whosebug joeyoung$ sort c.txt | uniq
a
b
c
g
v