码迷,mamicode.com
首页 > Web开发 > 详细

获取客户端ip访问网站的次数和请求页面脚本

时间:2018-05-21 17:00:41      阅读:690      评论:0      收藏:0      [点我收藏+]

标签:客户端ip访问网站的次数和请求页面脚本

获取客户端ip访问网站的次数和请求页面

#/bin/bash
cd /data/iplog/$1/pv
txt=$(ls -l|awk ‘{print $NF}‘|sed ‘1d‘)
for n in $txt
do
ip=$(cat /root/iplist)

for n1 in $ip
do
grep $n1 $n >>/opt/txt01/$n1-$1-cpv.txt

done
done

rep_txt=$(cd /opt/txt01/&&ls -l *cpv.txt|awk ‘{print $NF}‘|sed ‘1d‘)

cd /opt/txt01
for n2 in $rep_txt
do 
##cat $n2 |awk -F [/] ‘{print $3}‘|sort|uniq -c|sort -nr >>$n2-test
cat $n2|awk -F ‘[ ]+‘ ‘{print $4}‘|sort|uniq -c|sort -nr >>/opt/txt02/$n2-cpv
done
cd /opt/
tar zcf /opt/txt02/$1-$2-cpv-iplog.tar.gz ./txt02

[root@git-server test001]# cat /root/iplist 
117.136.79.39
117.136.79.32
117.136.79.33
117.136.79.37
117.136.79.36
120.239.77.229
223.104.63.150

[root@git-server test001]# cd /opt/txt01/
[root@git-server txt01]# ls
117.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.txt
117.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]# ls
117.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-cpv
117.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访问网站的次数和请求页面脚本

标签:客户端ip访问网站的次数和请求页面脚本

原文地址:http://blog.51cto.com/wujianwei/2118742

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!