标签:shell
#!/bin/bashcat num.txt
wc -l /var/log/nginx/access-app.log | awk ‘{print $1}‘
for ((i=$count+1;i<=$ncount;i++))
do
num=$[i]p
log=sed -n $num /var/log/nginx/access-app.log
tapi=echo $log | awk ‘{print $9}‘ | awk -NF ? ‘{print $1}‘
oapi=echo $tapi | sed ‘s?//?/?‘
if egrep "($oapi)$" api.txt > /dev/null 2>&1; then
napi=`egrep "($oapi)$" api.txt`
echo $log | sed s?$tapi?$napi?g >> access-app-elk.log
else
echo $log >> access-app-elk.log
fi
done
标签:shell
原文地址:http://blog.51cto.com/linux10000/2122549