#!/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"
或者直接导出
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"
Last modification:November 3, 2020
如果觉得我的文章对你有用,请随意赞赏