[英]strange uniq output on Mac
Here is the input file and output, I think characters like c and g should not be output?这里是输入文件和输出,我觉得像c和g这样的字符不应该输出吗?
$ uniq c.txt
a
g
b
g
c
v
c
$ cat c.txt
a
g
b
b
g
g
c
v
c
thanks in advance, Lin提前致谢,林
From the uniq man page :从uniq 手册页:
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:stackoverflow joeyoung$ cat c.txt
a
g
b
b
g
g
c
v
c
macbook:stackoverflow joeyoung$ uniq c.txt
a
g
b
g
c
v
c
macbook:stackoverflow joeyoung$ sort -u c.txt
a
b
c
g
v
macbook:stackoverflow joeyoung$ sort c.txt | uniq
a
b
c
g
v
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.