awk的替代先sort 再uniq -c 再sort ,uniq只能队相邻的起作用sort先让之间相邻再sort,最后sort是数量排序

[root@localhost ~]# cat aa.txt |sort|uniq -c|sort -nk1
1 22
1 44
1 55
1 bb
1 dd
1 ff
1 gg
1 kk
1 oo
1 pp
2
2 cc
4 aa
5 22
5 33
5 55
8 111

原文地址:https://www.cnblogs.com/gaoyuechen/p/9927616.html