你的位置:首页 > 软件开发 > 操作系统 > 1.uniq去重命令讲解

1.uniq去重命令讲解

发布时间:2016-04-07 16:00:07
uniq命令:常见参数:-c,--count ***** 在每行旁边显示改行重复出现的次数-d,--repeated 仅显示重复出现的行,2次或2次以上的行,默认的去重包含1次。 例子:a.只对相邻的相同行内容去重。 [ro ...

1.uniq去重命令讲解

uniq命令:

常见参数:

a.只对相邻的相同行内容去重。

 
  1. [root@nfs-server test]# sort test.txt|uniq
  2. 10.0.0.7
  3. 10.0.0.8
  4. 10.0.0.9
  5. [root@nfs-server test]#
  1. [root@nfs-server test]# sort -u test.txt
  2. 10.0.0.7
  3. 10.0.0.8
  4. 10.0.0.9
  1. [root@nfs-server test]# sort test.txt|uniq -c
  2. 210.0.0.7
  3. 310.0.0.8
  4. 210.0.0.9
-c,--count 去重计数http://post.judong.org/index.html
  1. [root@nfs-server test]# awk -F /'{print $3}' test.log|sort
  2. mp3.judong.org
  3. post.judong.org
  4. post.judong.org
  5. www.judong.org
  6. www.judong.org
  7. www.judong.org
  8. [root@nfs-server test]# awk -F /'{print $3}' test.log|sort|uniq -c
  9. 1 mp3.judong.org
  10. 2 post.judong.org
  11. 3 www.judong.org
  12. [root@nfs-server test]#
  1. [root@nfs-server test]# awk -F /'{print $3}' test.log|sort|uniq -c|sort -r ##-r,表示倒序排列
  2. 3 www.judong.org
  3. 2 post.judong.org
  4. 1 mp3.judong.org
  5. [root@nfs-server test]#
cut 切割,简单的取列命令 

来自为知笔记(Wiz)


原标题:1.uniq去重命令讲解

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录