Monday, April 27, 2009

ruby script to search for email addresses in a log file

Given input that is ":" delimited, this script will search out email addresses in any field in the input:


cat log_file.txt | ruby -ne 'split(":").each { |col| print col , "\n" if col.match(/^\S+@\S+$/) }' | sort | uniq

No comments: