sort demo|uniq|wc -l
cat demo |wc -l
[zhenan@kael236 ~]$ cat demo |wc -l
8
[zhenan@kael236 ~]$ sort demo |uniq|wc -l
6
[zhenan@kael236 ~]$
[zhenan@kael236 ~]$ cat demo
aa
bb
cc
aa
bbdd
cc
dd
ee
[zhenan@kael236 ~]$ sort demo|uniq
aa
bb
bbdd
cc
dd
ee
[zhenan@kael236 ~]$ sort demo|uniq -c
2 aa
1 bb
1 bbdd
2 cc
1 dd
1 ee
[zhenan@kael236 ~]$ sort demo|uniq -d
aa
cc
[zhenan@kael236 ~]$ sort demo|uniq -u
bb
bbdd
dd
ee
[zhenan@kael236 ~]$
转载于:https://blog.51cto.com/tianshili/1638539