uniq基本

uniq命令:
uniq [OPTION]... [FILE]...
-c: 显示每行重复出现的次数;

[root@ansible ~]# cat test.txt 
this is test
this is test
this is your list
this is this
[root@ansible ~]# uniq -c test.txt 
      2 this is test
      1 this is your list
      1 this is this

-d: 仅显示重复过的行;

[root@ansible ~]# cat test.txt 
this is test
this is test
this is your list
this is this
[root@ansible ~]# uniq -d test.txt 
this is test

-u: 仅显示不曾重复的行;

[root@ansible ~]# cat test.txt 
this is test
this is test
this is your list
this is this
[root@ansible ~]# uniq -u test.txt 
this is your list
this is this

你可能感兴趣的:(uniq基本)