#/bin/bashcd /data/iplog/$1/pvtxt=$(ls -l|awk ‘{print $NF}‘|sed ‘1d‘)for n in $txtdoip=$(cat /root/iplist)for n1 in $ipdogrep $n1 $n >>/opt/txt01/$n1-$1-cpv.txtdonedonerep_txt=$(cd /opt/txt01/&&ls -l *cpv.txt|awk ‘{print $NF}‘|sed ‘1d‘)cd /opt/txt01for n2 in $rep_txtdo ##cat $n2 |awk -F [/] ‘{print $3}‘|sort|uniq -c|sort -nr >>$n2-testcat $n2|awk -F ‘[ ]+‘ ‘{print $4}‘|sort|uniq -c|sort -nr >>/opt/txt02/$n2-cpvdonecd /opt/tar zcf /opt/txt02/$1-$2-cpv-iplog.tar.gz ./txt02[root@git-server test001]# cat /root/iplist 117.136.79.39117.136.79.32117.136.79.33117.136.79.37117.136.79.36120.239.77.229223.104.63.150[root@git-server test001]# cd /opt/txt01/[root@git-server txt01]# ls117.136.79.32-2018-05-17-cpv.txt ?117.136.79.36-2018-05-17-cpv.txt ?117.136.79.39-2018-05-17-cpv.txt ??223.104.63.150-2018-05-17-cpv.txt117.136.79.33-2018-05-17-cpv.txt ?117.136.79.37-2018-05-17-cpv.txt ?120.239.77.229-2018-05-17-cpv.txt[root@git-server txt01]# cd /opt/txt02/[root@git-server txt02]# ls117.136.79.33-2018-05-17-cpv.txt-cpv ?117.136.79.37-2018-05-17-cpv.txt-cpv ?120.239.77.229-2018-05-17-cpv.txt-cpv ?223.104.63.150-2018-05-17-cpv.txt-cpv117.136.79.36-2018-05-17-cpv.txt-cpv ?117.136.79.39-2018-05-17-cpv.txt-cpv ?2018-05-17-233-cpv-iplog.tar.gz[root@git-server txt01]# head -10 /opt/txt02/117.136.79.37-2018-05-17-cpv.txt-cpv ??????6 http://m.31xs.net/13/13431/10319091.html ?????4 https://m.yubook.net/novel/61462/7938632.html ?????4 https://m.ybdu.com/xiaoshuo/18/18935/6895763.html ?????4 https://m.xiaoshuoli.com/i35445/18566473.html ?????4 https://m.xiaoshuoli.com/i18640/18476060.html ?????4 https://m.biquxu.com/24/24853/12085909.html ?????4 http://m.wutuxs.com/html/1/1071/842907.html ?????4 http://m.sanhao33.com/sort-8-5/ ?????4 http://m.jw46.com/sort/ ?????4 http://m.bxwx.io/book_77838/22048312.html获取客户端ip访问网站的次数和请求页面脚本
原文地址:http://blog.51cto.com/wujianwei/2118742