~ cat access.log.10 | awk '{a[$1]++} END {for(b in a) print b"\t"a[b]}' | sort -k2 -r | head -n 10163.177.71.12 972101.226.68.137 972183.195.232.138 97150.116.27.194 9714.17.29.86 9661.135.216.104 9461.135.216.105 9161.186.190.41 959.39.192.108 9220.181.51.212 9
显示所有ip:n,(n表示次数)
cat web_737_com.access_log | awk '{a[$1]++} END {for(b in a) print b":"a[b]}'
61.138.100.90:20
157.55.39.125:3
121.42.0.56:2
。。。。
显示10条,没排序
cat web_737_com.access_log | awk '{a[$1]++} END {for(b in a) print b":"a[b]}' | head -n 10
61.138.100.90:20
157.55.39.125:3
121.42.0.56:2
207.46.13.80:8
123.11.99.148:46
59.172.149.197:12
125.112.245.207:58
123.169.142.98:35
222.128.136.228:10
1.71.34.67:14