Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin ruby
- r=Regexp.new('^(.{11})\s(\d\d:\d\d:\d\d)\s(\S+)\s(\w+\.\w+)\s(\w+):\s+(ACCEPT|REJECT|DROP)\s+(.*$)')
- n1=0
- n2=0
- File.open('kern.log','r') do |aFile|
- aFile.readlines.each do |nextline|
- if nextline =~ r
- n1+=1
- else
- n2+=1
- end
- end
- end
- puts n1, n2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement