- 文本排序 sort
[root@xuhx-02 sort]# sort sort.sh
1
2
3
5
6
[root@xuhx-02 sort]# sort -r sort.sh
6
5
3
2
1
- 文本去重 uniq
- 先排序再去重
[root@xuhx-02 sort]# sort uniq.sh |uniq
1
2
3
4
5
- -c: 显示文件中行重复的次数
[root@xuhx-02 sort]# sort uniq.sh |uniq -c
1 1
1 2
2 3
1 4
2 5
- -d: 只显示重复的行(相邻的行)
[root@xuhx-02 sort]# sort uniq.sh |uniq -d
3
5
- 文本统计 wc
- -l:多少行
- -w:多少单词
- -c:多少字符
- -L:最长的一行包含了多少个字符