Last active
December 29, 2015 17:59
-
-
Save danilovazb/7707932 to your computer and use it in GitHub Desktop.
Exporte uma lista de contatos em .csv para vCard(.vcf) ;)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
################################################# | |
# csv2vCard 1.0 | |
# | |
# c0d3r: Danilo Vaz | |
# Dt:29/11/2013 | |
# HappyBirtdayForMy (: | |
# danilovazb[at]hotmail[dot]com | |
# Gr33tz: N4sss, Clandestine, Cooler_ | |
# | |
################################################# | |
system('clear'); | |
#############-----> Banner <-----################ | |
print << "Abertura"; | |
################################################# | |
# \033[34;5;1mcsv2vCard 1.0\033[0m # | |
# # | |
# \033[36;1mc0d3r:\033[0m Danilo Vaz # | |
# \033[36;1mDt:\033[0m29/11/2013 # | |
# \033[31;1mHappy\033[0m\033[35;1mBirthday\033[0m\033[33;1mFor\033[0m\033[36;1mMe\033[0m (: # | |
# \033[32;1mGr33tz:\033[0m N4sss, Clandestine, Cooler_ # | |
# # | |
################################################# | |
Abertura | |
################################################# | |
my $file = $ARGV[0] or die "\n\n\033[36;1mModo de uso:\033[0m\n~$ perl csv2vCard.pl <arquivo>.csv\n\n\033[36;1mLayout de importação:\033[0m\n NOME;SOBRENOME;EMAIL;CELULAR\n\n"; | |
open (FILE, $file); | |
while (<FILE>) { | |
chomp; | |
($nome, $CPF, $email, $endereco, $fone) = split(";"); | |
($um, $dois, $tres, $quatro) = split(/ /,$nome); | |
print "BEGIN:VCARD\n" ; | |
print "VERSION:3.0\n"; | |
print "FN:$nome\n"; | |
print "N:$um;$dois;$tres;$quatro\n"; | |
print "EMAIL;TYPE=INTERNET:$email\n"; | |
print "TEL;TYPE=HOME:+55 $fone\n"; | |
print "NOTE:Sobrenome\\: $CPF\\n\n"; | |
print "END:VCARD\n"; | |
} | |
close (FILE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment