Archive for Decembro, 2014

How to split a multi-person vCard into individual vCards

Decembro 4, 2014

It seems that Microsoft Outlook still struggles to import multi-person vCard files. It can, though, import a batch of smaller files with one contact in each file. <sigh>

(Apparently you can import such a file into Windows Contact Manager, and then export your contacts from there to Outlook, so that might work for you. Let me know how you get on.)

If you want to help your users to avoid jumping through so many hoops though, you might want to split your multi-person vCard into individual files yourself, so here’s an AWK script to do it.

tl;dr:

~$ awk ‘BEGIN {x=”F0.vcf”} /BEGIN:VCARD/ {close(x);x=”F”++i”.vcf”} {print > x;}’ multi_person_vCard.vcf

…where multi_person_vCard.vcf is the name of the file you want to split up. The script will create a series of files called F1.vcf, F2.vcf, F3.vcf, etc., with one contact in each file. These can be imported directly into Outlook.

NB The script is a “quick and dirty” solution, and will overwrite any existing files named F1.vcf, F2.vcf, etc., so be careful of this if you use it regularly.

Advertisements