How to split a multi-person vCard into individual vCards

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

Respondi

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ŝanĝi )

Twitter picture

You are commenting using your Twitter account. Log Out / Ŝanĝi )

Facebook photo

You are commenting using your Facebook account. Log Out / Ŝanĝi )

Google+ photo

You are commenting using your Google+ account. Log Out / Ŝanĝi )

Connecting to %s


%d bloggers like this: