uniq 命令详解

作用: 报告或忽略文件中的重复行,一般与sort 连用。

选项:-c count 在每列前显示该行重复出现的次数
    -d repeated, 仅显示重复出现的行列
    -f skip field 忽略比较指定的栏位
    -s skip chars 忽略比较指定的字符
    -u unique 仅显示出现一次的行列
    -w 字符位置
实例:
    显示不重复行数据
    uniq file / sort file |uniq  / sort -u file 、uniq -u file 
    统计各行出现的次数
    sort file |uniq -c 
    显示重复行数据
    sort file |uniq -d

 

原文地址:https://www.cnblogs.com/LinuxSuDa/p/4409928.html