Skip to content

Instantly share code, notes, and snippets.

@AlexTalker
Created March 28, 2014 14:40
Show Gist options
  • Save AlexTalker/9834387 to your computer and use it in GitHub Desktop.
Save AlexTalker/9834387 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'vcardigan'
vcards = ARGV.map {|file|
File.foreach(file, "END:VCARD").map {|vcard_data| VCardigan.parse vcard_data }
}.flatten
numbers = vcards.map(&:tel)
.compact
.map {|tel| tel.first.value.gsub(/\D/, '') }
.select {|number| number.match /^(7|380)\d{10,}/ }
File.write 'telephons.txt', numbers.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment