一个统计数据的问题 求指点
113.64.79.0 - - [04/Jul/2012:10:03:41 +0800] "GET /upfile/201207/201207040939177110.jpg HTTP/1.1" 200 18315 "http://www.liketry.com/paytry.php" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; 360SE)" -
27.115.127.146 - - [04/Jul/2012:10:03:41 +0800] "GET /images/default/fufei.png HTTP/1.1" 304 0 "http://www.liketry.com/index.php" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0(Compatible Mozilla/4.0(Compatible-EmbeddedWB 14.59 http://bsalsa.com/ EmbeddedWB- 14.59 from: http://bsalsa.com/ ; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; Maxthon 2.0)" -
116.21.255.71 - - [04/Jul/2012:10:03:41 +0800] "GET /images/ui-bg_glass_100_f6f6f6_1x400.png HTTP/1.1" 200 1009 "http://www.liketry.com/user_login.php?returnurl=http%3A%2F%2Fwww.liketry.com%2Fget_password.php%3Fmail%3D512695867%40qq.com%26&rr=0&[email protected]&error=5a+G56CB6ZSZ6K+v" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; .NET CLR 2.0.50727; 360SE)" -
类似这种记录 一个 有 一万条
我取了三条
我需要 从这些数据中 的到 做例子 字符串中 "http: xxxx" 前面的 那个流量数据
求方法
------解决方案--------------------
// 这个实现有多种方法,现在列出其中的一种preg_match_all('/\"GET[ ]*\/upfile[^ ]+[ ]+HTTP\/1\.1\"[ ]+\w+[ ]+(\d+)[ ]+\"/', $s, $a1);preg_match_all('/\"GET[ ]*\/(?!upfile)[^ ]+[ ]+HTTP\/1\.1\"[ ]+(\d+)[ ]+(\d+)[ ]+\"/', $s, $a2);//p($a1);p($a2);<br><font color="#e78608">------解决方案--------------------</font><br>日志是一行一行的, 这种统计太基础了, awk/cut/php按空白分割取第N段就行了。<div class="clear"> </div>