Advertisement
haazee

l1.rb

Aug 14th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.28 KB | None | 0 0
  1. #!/usr/bin ruby
  2.  
  3. r=Regexp.new('^(.{11})\s(\d\d:\d\d:\d\d)\s(\S+)\s(\w+\.\w+)\s(\w+):\s+(ACCEPT|REJECT|DROP)\s+(.*$)')
  4.  
  5. n1=0
  6. n2=0
  7. File.open('kern.log','r') do |aFile|
  8.     aFile.readlines.each do |nextline|
  9.         if nextline =~ r
  10.             n1+=1
  11.         else
  12.             n2+=1
  13.         end
  14.     end
  15. end
  16. puts n1, n2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement