[root@localhost sa]# cat /var/log/nginx/access.log |cut -d " " -f 1 |sort |uniq -c |sort -nr |head -n 10
30 172.16.39.211
29 172.16.39.216
27 172.16.39.215
27 172.16.39.212
26 172.16.39.213
26 172.16.39.131
26 172.16.39.132
26 172.16.39.133
25 172.16.39.134
21 172.16.39.138
使用awk命令过滤:
[root@localhost sa]# cat /var/log/nginx/access.log |awk -F ' ' '{print $1}' |sort |uniq -c |sort -nr |head -n 10
30 172.16.39.211
29 172.16.39.216
27 172.16.39.215
27 172.16.39.212
26 172.16.39.213
26 172.16.39.131
26 172.16.39.132
26 172.16.39.133
25 172.16.39.134
21 172.16.39.138