
$file="g:/log/x.log";%map=();open(IN,"<$file") || dIE "Couldn't open $filename for reading: $!";$num=0;$v=0;$str="";while($line=<IN>){ if (!($line=~m/.*logID.*phonenumber.*message.*/)) {#不匹配就继续循环 next; } #print $line."\n"; $str=substr($line,20);#cut str if(exists ($map{$str})) { $v=$map{$str}; $v++; $map{$str}=$v; }else{ $map{$str}=1; } #print $str."===".$map{$str}."\n";}close($IN);while (($key,$value) = each(%map) ) { if($value>40){ print "$key ------$value "."\n"; }} 总结 以上是内存溢出为你收集整理的使用perl统计日志中单位时间内的请求数全部内容,希望文章能够帮你解决使用perl统计日志中单位时间内的请求数所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)