comparison log_analyze.rb @ 1:4f7103163762 default tip

update
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Wed, 18 Jul 2018 18:03:58 +0900
parents b42d5cbbd972
children
comparison
equal deleted inserted replaced
0:b42d5cbbd972 1:4f7103163762
5 user_name = Regexp.new("anatofuzMBP|anatofuz-15") 5 user_name = Regexp.new("anatofuzMBP|anatofuz-15")
6 count = Hash.new(0) 6 count = Hash.new(0)
7 7
8 File.open(file,'r') do |f| 8 File.open(file,'r') do |f|
9 f.each_line do |line| 9 f.each_line do |line|
10 if line =~ /\w \d{0,2} (?:\d{2}:?){3} #{user_name} ([\w.]+)\[\d+\]/ 10 if line =~ /\w+ \d{0,2} (?:\d{2}:?){3} #{user_name} ([\w.]+)\[\d+\]/
11 count[$1] += 1 11 count[$1] += 1
12 end 12 end
13 end 13 end
14 end 14 end
15 15