Linux uniq
root@Fcant:~ $ cat ghostwu.txt192.168.1.2192.168.1.8192.168.1.3192.168.1.3192.168.1.9192.168.1.8192.168.1.8192.168.1.0192.168.1.3root@Fcant:~ $ uniq ghosts.txt192.168.1.2192.168.1.8192.168.1.3192.168.1.9192.168.1.8192.168.1.0192.168.1.3
-u:只保留文件中的唯一
root@Fcant:~ $ uniq -u ghosts.txt192.168.1.2192.168.1.8192.168.1.9192.168.1.0192.168.1.3
-c:去重复,并计算每行出现的次数
root@Fcant:~ $ uniq -c ghosts.txt1 192.168.1.21 192.168.1.82 192.168.1.31 192.168.1.92 192.168.1.81 192.168.1.01 192.168.1.3root@Fcant:~ $ cat -n ghosts.txt1 192.168.1.22 192.168.1.83 192.168.1.34 192.168.1.35 192.168.1.96 192.168.1.87 192.168.1.88 192.168.1.09 192.168.1.3
可以用sort命令排序后,再去重复,得到的结果 也是唯一的
root@Fcant:~ $ sort -n ghosts.txt | uniq -c1 192.168.1.01 192.168.1.23 192.168.1.33 192.168.1.81 192.168.1.9
-d: 只显示重复的行
root@Fcant:~ $ uniq -d ghosts.txt192.168.1.3192.168.1.8
