网站开发技术

记点笔记、 学点技术 欢迎交流建站技术。本站关注lamp技术

您尚未登录。

#1 2014-12-21 10:21:35

admin
管理员

linux uniq 命令示例

uniq 是去除相邻行的命令。 仅仅是处理相邻行的处理。

有三个常用的参数 

-c:打印的时候,多打印一个数,这个数表示行重复的次数

-d: 这个表示打印的都是重复的行,并且只显示一次, 当然 -cd 就是加上重复的次数了

-u: 仅仅打印没有重复的行。

示例

 cat a.txt
this is one
this is three
this is two
this is two
this is three
this is three
[root@qd ~]# uniq -c a.txt
      1 this is one
      1 this is three
      2 this is two
      2 this is three
[root@qd ~]# uniq -d a.txt
this is two
this is three
[root@qd ~]# uniq -u a.txt
this is one
this is three
[root@qd ~]# uniq -cd a.txt
      2 this is two
      2 this is three



ipbbs.net

离线

页脚

Powered by FluxBB