Skip to content

Instantly share code, notes, and snippets.

@ravensnowbird
Created August 24, 2015 11:51
Show Gist options
  • Save ravensnowbird/61dfb7eef99e44c745e1 to your computer and use it in GitHub Desktop.
Save ravensnowbird/61dfb7eef99e44c745e1 to your computer and use it in GitHub Desktop.
path = "/home/raven/Downloads/linkedin_connections_export.vcf"
lines = File.read(path).split("\n")
a = []
lines.split("BEGIN:VCARD").each do |line|
if !(line.empty?)
data = "BEGIN:VCARD\r\n" + line
v = VCardigan.parse(data)
puts v.fn.first.values.first
puts v.email.first.values.first
title = v.title.nil? ? "" : v.title.first.values.first
org = v.org.nil? ? "" : v.org.first.values.first
puts title
puts org
a << "\"#{v.fn.first.values.first.gsub(",", "\,")}(#{v.email.first.values.first.gsub(",", "\,")})\",\"Lead\", \"\", \"Vivek's LinkedIn - #{title.gsub(",", "\,")} - #{org.gsub(",", "\,")} \""
end
end
a.each{|x| puts x}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment