shell uniq 统计,计数


 

uniq
选项与参数
-i:忽略大小写
-c:进行计数
[zhang@localhost ~]$ cat 2.txt
hello
Hello
WOrld
abc
abc
ABC
hello1

对2.txt进行sort后,进行uniq。
[zhang@localhost ~]$ cat 2.txt | sort | uniq
abc
ABC
hello
Hello
hello1
WOrld

进行sort,使用uniq忽略大小写
[zhang@localhost ~]$ cat 2.txt | sort | uniq -i
abc
hello
hello1
WOrld

进行sort,使用uniq进行计数
[zhang@localhost ~]$ cat 2.txt | sort | uniq -c
2 abc
1 ABC
1 hello
1 Hello
1 hello1
1 WOrld


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM