#!/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 3rd, 2020 at 09:50 am
如果觉得我的文章对你有用,请随意赞赏