liunx脚本查看某段时间内百度爬虫日志

2022-09-11 14:18:51 浏览数 (1)

代码语言:javascript复制
#!/bin/sh
cd /data/webserver/nginx/logs
read -p "Please Enter setime(eg. '10-15'):" setime
if [ ! $setime ];
 then
   echo "Input format error"
   exit 0
fi
sed -n "/2020-'${setime} '00:00:00/,/2020-'${setime} '23:59:59/p" xxxx_access.log | grep Baiduspider >> "/tmp/2020-${setime}.log"

或者直接导出
代码语言:javascript复制
sed -n  "/2020-11-03 00:00:00/,/2020-11-03 23:59:59/p" /data/webserver/nginx/logs/xxxx.log | grep Baiduspider >> "/data/www/xxxxx/xxxx.log"

0 人点赞