Migrating Contacts from Evolution to Kontact
I’ve toyed around with the idea of migrating everything over to Kontact for my mail. I’ve used Evolution since moving over to linux, but there are some things about Kontact that just seem slicker to me. While I was doing the install, I had the laptop setup to receive messages through IMAP and used Kontact as the client. There were a few features that I wanted to spend a bit more time with. So, the first thing is getting the data into Kontact.
I’m most concerned about my contacts, or addressbook. Let’s face it. If I lost all my old emails it would be disappointing, there are some I couldn’t afford to lose and their copied to the imap server as a backup. Contacts though are another matter. To do this, here’s what I did…
First open Evolution and go to the contacts view. Press control-a to select all contacts and when their all highlighted go to the file menu and select “save as vcard”. This will save the whole list to a file that you get to name (and place). I made an export directory and saved to list.vcf
So, after this I tried an import into Kontact. (Kontact – choose contacts, file, import, import vCard, select file). There were a couple odd things though, home telephone numbers showed up as other. It seems evolution classified them as home/voice… time for sed – I deleted the list from contact and went to the command line. Note – there are gui tools that will search and replace text in a file that work quite well – I found it quicker to do this.
cd export
cat list.vcf | sed -e ‘s/TYPE=HOME;TYPE=VOICE/TYPE=HOME/g’ > list2.vcf
Next, I noticed a similar problem with Work/Voice – so…
cat list2.vcf | sed -e ‘s/TYPE=WORK;TYPE=VOICE/TYPE=WORK/g’ > list3.vcf
Finally, I imported again and noticed that address fields looked odd… for instance what should have been Asheville, NC showed up as Asheville\, NC (too much escaping in the vcf?) – so I deleted the contacts one last time and did…
cat list3.vcf | sed -e ‘s/\\\,/,/g’ > list4.vcf
Imported again and most everything looks good. The only problem left is about 11 contacts that didn’t have a true name or organization entered, for some reason when I’d entered it evolution only gave it a X-EVOLUTION-FILE-AS: field… For 11 entries it’s probably not worth trying to do an automated parsing. (It would likely interfere with entries that DO have either the name or organization fields.)