uniq命令通过消除重复内容,只能用于排过序的数据
cat sorted.txt
bash
foss
hack
hack
uniq sorted.txt
bash
foss
hack
sort unsorted.txt|uniq
sort -u unsorted.txt
只显示唯一的行
uniq -u sorted.txt
bash
foss
sort unsorted.txt | uniq -u
sort unsorted.txt | uniq -c
1 bash
1 foss
2 hack
找出文件中重复的行
sort unsorted.txt | uniq -d
hack