Shell获取某个时间段的nginx日志内容
跳到导航
跳到搜索
方法1:sed
cat sdkv2.52wan.dkmol.net.access.log-20170627 | egrep "27/Jun/2017" | sed -n '/00:00:18/,/00:00:19/p'
方法二:awk
cat web.log | egrep "01/Apr/2014" | awk -F':' '$2 = 21 && $3 >= 30 && $3 <= 50'
参考
http://blog.csdn.net/kelonsen/article/details/23033485
日志常用统计技巧 http://xstarcd.github.io/wiki/shell/logview_tips.html