可以使用sort, uniq 来作排序和统计
[gan@localhost ftmp]$ cat file.txt | sort
1
2
2
235
3
3
3
44
66
78
9900
[gan@localhost ftmp]$ cat file.txt | sort | uniq -c
1 1
2 2
1 235
3 3
1 44
1 66
1 78
1 9900
统计某类字符出现的次数:
[gan@localhost ftmp]$ grep 2 file.txt
2
2
235
[gan@localhost ftmp]$ grep -c 2 file.txt
3
阅读(2106) | 评论(0) | 转发(0) |