Created
February 18, 2015 22:00
-
-
Save crookedstorm/761a1028a9d662f4505e to your computer and use it in GitHub Desktop.
Parse a test log file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A quick log parse | |
if File.readable?("test-sample.log") | |
logfile = File.open("test-sample.log", "r") | |
else | |
abort "File not found!" | |
end | |
logfile.each do |line| | |
if /^.*id=([\w\-@.]+).*T=(".*")/ =~ line | |
puts "ID: #{$1}\t\tSUBJECT: #{$2}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment