Skip to content

Instantly share code, notes, and snippets.

@crookedstorm
Created February 18, 2015 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crookedstorm/761a1028a9d662f4505e to your computer and use it in GitHub Desktop.
Save crookedstorm/761a1028a9d662f4505e to your computer and use it in GitHub Desktop.
Parse a test log file.
# 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