uniq 命令用于检查及删除文本文件中重复出现的行列,一般与 sort 命令结合使用 # sort # uniq -c : 检查文件并删除文件中重复出现的行,并在行首显示该行重复出现的次数cat test.log| grep "test" | sort|uniq -c# 输出结果: 1 test 1 1 test 2 3 test 3 3 test 1# uniq -d : 在文件中找出重复的行cat test.log | uniq -d# 输出结果: test 3 test 1