sort -t”.” -k1,1n -k2,2n -k3,3n -k4,4n ip.lst
#cat t.txt
172.30.100.103
172.30.161.239
172.31.155.5
172.31.155.5
172.30.100.103
172.30.100.103
172.30.100.103
172.31.176.59
172.31.176.59
172.31.176.59
172.31.176.59
172.30.100.103
172.30.161.239
172.30.161.239
172.30.161.239
#cat t.txt| sort | uniq -c | sort -n -r
5 172.30.100.103
4 172.31.176.59
4 172.30.161.239
2 172.31.155.5
sort:对IP部分进行排序。
uniq -c:打印每一重复行出现的次数。(并去掉重复行)
sort -n -r:按照重复行出现的次序倒序排列。