首页 > 系统服务 > 详细

shell uniq 统计,计数

时间:2019-05-08 22:59:44      阅读:274      评论:0      收藏:0      [点我收藏+]

 

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

shell uniq 统计,计数

原文:https://www.cnblogs.com/sea-stream/p/10835473.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!