time sed ‘s/\[//g‘ yjunzi.access.log.1 |awk ‘$4 >="16/Aug/2015:00:00:00" && $4 <="17/Aug/2015:00:00:00"‘ | awk {‘print $1‘} | sort -n |uniq -c| wc
首先看出的文本格式:
# cat yjunzi.access.log.1
66.249.67.87 - - [16/Aug/2015:04:03:06 +0800] "GET /album/1382.html HTTP/1.1" 200 5049 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "-"
sed ‘s/\[//g‘ yjunzi.access.log.1 |awk ‘$4 >="16/Aug/2015:00:00:00" && $4 <="17/Aug/2015:00:00:00"‘ #通过awk过滤出8月16号0点到8月17号0点时间段的内容
66.249.67.87 - - 16/Aug/2015:04:03:06 +0800] "GET /album/1382.html HTTP/1.1" 200 5049 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "-"
sed ‘s/\[//g‘ yjunzi.access.log.1 |awk ‘$4 >="16/Aug/2015:00:00:00" && $4 <="17/Aug/2015:00:00:00"‘ | awk {‘print $1‘} | sort |uniq -c | sort -n | wc #通过awk取出IP段,sort排序,wc查看有多少行;
69 138 1544
时间: 2024-10-10 14:57:02