If you are using Evolution, and you want to migrate to something better (like Mozilla Thunderbird), this may be helpful to you. Evolution can export its addressbook to a vcard format, but Mozilla Thunderbird cannot import vcard addressbook. The script will export your evolution addressbook to a tab seperated file which you can then import into Thunderbird. And hopefully live happily after.
There are two scripts -
exportevolution.py -> Python script to export your evolution addressbook to the vcard format.
vcard2tab.pl -> Perl script to convert the vcard produced above to tab seperated file.
copy these two scripts, do a 'chmod a+x exportevolution.py' and 'chmod a+x vcard2tab.pl' . Next use the following command ``./exportevolution.py|./vcard2tab.pl >addressbook.tab`` You will have your arressbook in addressbook.tab . If you have found an easier way to do it, please let me know.
===start file exportevolution.py=== #!/usr/bin/python2
import bsddb, os, re
home = os.getenv('HOME')
# This is the only variable you should change. If you do not know the # location of your evloution address book, use `locate addressbook.db` # to find it
dbname = '%s/evolution/local/Contacts/addressbook.db' % home
db = bsddb.hashopen(dbname, 'r')
for k in db.keys(): for line in db[k].split('\n'): print line
db.close() ===end file exportevolution.py===
===start file vcard2tab.pl=== #!/usr/bin/perl
use strict; my $line; my $name; my $tel_work_voice; my $tel_work_fax; my $tel_home; my $tel_pager; my $tel_cell; my $tel_voice; my $email;
while ( $line = <STDIN> ) { chomp ($line); chop ($line) ; # trailing ^M
#BEGIN:VCARD if ( $line eq "BEGIN:VCARD" ) { $name = ""; $tel_work_voice = ""; $tel_work_fax = ""; $tel_home = ""; $tel_pager = ""; $tel_cell = ""; $tel_voice = ""; $email = ""; }
#X-EVOLUTION-FILE-AS: if ( $line =~ /^X-EVOLUTION-FILE-AS\:.*/ ) { $line =~ s/^X-EVOLUTION-FILE-AS://g; $name = $line; print $name." "; print "\t"; }
#TEL;WORK;VOICE; if ( $line =~ /^TEL;WORK;VOICE:.*/ ) { $line =~ s/^TEL;WORK;VOICE://g; $tel_work_voice = $line; }
#TEL;WORK;FAX; if ( $line =~ /^TEL;WORK;FAX:.*/ ) { $line =~ s/^TEL;WORK;FAX://g; $tel_work_fax = $line; }
#TEL;HOME; if ( $line =~ /^TEL;HOME:.*/ ) { $line =~ s/^TEL;HOME://g; $tel_home = $line; }
#TEL;PAGER; if ( $line =~ /^TEL;PAGER:.*/ ) { $line =~ s/^TEL;PAGER://g; $tel_pager = $line; }
#TEL;CELL; if ( $line =~ /^TEL;CELL:.*/ ) { $line =~ s/^TEL;CELL://g; $tel_cell = $line; }
#TEL;VOICE; if ( $line =~ /^TEL;VOICE:.*/ ) { $line =~ s/^TEL;VOICE://g; $tel_voice = $line; }
#EMAIL;INTERNET; if ( $line =~ /^EMAIL;INTERNET:.*/ ) { $line =~ s/^EMAIL;INTERNET://g; $email = $email.$line; }
#EMAIL;QUOTED-PRINTABLE;INTERNET; if ( $line =~ /^EMAIL;QUOTED-PRINTABLE;INTERNET:.*/ ) { $line =~ s/^EMAIL;QUOTED-PRINTABLE;INTERNET://g; $line =~ s/=0A/ /g; #=0A make it a space $email = $email.$line; }
#END:VCARD if ( $line eq "END:VCARD" ) { if ( $tel_work_voice eq "" ) { print "\t";} else { print "wk=".$tel_work_voice."\t"; } if ( $tel_work_fax eq "" ) { print "\t"; } else {print "fx=".$tel_work_fax."\t"; } if ( $tel_home eq "" ) { print "\t"; } else { print "hm=".$tel_home."\t"; } if ( $tel_pager eq "" ) { print "\t"; } else { print "pg=".$tel_pager."\t"; } if ( $tel_cell eq "" ) { print "\t"; } else { print "cel=".$tel_cell."\t"; } if ( $tel_voice eq "" ) { print "\t"; } else { print "alt=".$tel_voice."\t"; } if ( $email eq "" ) {print "\t";} else { print $email; } print "\n"; } }
===end file vcard2tab.pl===
-- / \__ ( @\___ Raj Shekhar / O My home : http://geocities.com/lunatech3007/ / (_____/ My blog : http://lunatech.journalspace.com/ /_____/ U
_______________________________________________ ilugd mailing list [EMAIL PROTECTED] http://frodo.hserus.net/mailman/listinfo/ilugd