截取nginx日志
sed -n '/24/Feb/2017:11:00:00/,/24/Feb/2017:12:00:00/p' yunying_api.wanglibao.com.access.log > a.log #发现会有12点以后的日志
sed -n '/24/Feb/2017:11:00:00/,/24/Feb/2017:11:59/p' yunying_api.wanglibao.com.access.log > b.log #截取的是11点到12点的日志
获取访问前10的IP
[root@ik1xj93vhZ logs]# awk '{print $1}' a.log|sort |uniq -c |sort -rn -k1|head -10
192174 223.73.131.38
4019 42.248.43.45
1626 218.24.15.90
1205 223.104.186.220
820 223.104.4.40
540 121.31.20.146
473 112.10.108.103
426 182.18.19.162
403 117.136.78.189
356 58.57.45.106
转载于:https://blog.51cto.com/dengyong/1900959