Skip to content

Instantly share code, notes, and snippets.

@bpo
Created October 29, 2015 23:52
Show Gist options
  • Save bpo/a3ed23da181d6954e429 to your computer and use it in GitHub Desktop.
Save bpo/a3ed23da181d6954e429 to your computer and use it in GitHub Desktop.
strip a document of formatted address lists and names down to just the email addresses themselves
#! /usr/bin/ruby
require 'mail'
$stdin.each_line do |line|
addresses = Mail::AddressList.new(line.chomp)
addresses.addresses.each do |a|
puts a.address
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment