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
如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术
转载请注明:shell命令uniq 出自老鄢博客 | 欢迎分享