Sai Karthik

Balancing the braces ...

Merging Multiple Vcards On Linux

October 20, 2019 | 1 minute read

Recently, I needed to transfer contacts from an old samsung feature phone to an android smartphone. The issue i faced was that the samsung feature phone backups all contacts in a folder & organises them as one vcf file per contact, But android’s vcard saves all contacts in a single file. So, I found a way of merging all these indvidual vcards into single vcard by simply using linux command.

cd into the folder containing all vcards

then

cat * >> contacts.vcf

That’s it ! Now all the contacts are merged into the contactList.vcf file

What’s happening in the background?

Let’s look at the anatomy of a single vcard entry

1
2
3
4
5
BEGIN:VCARD
VERSION:2.1
N;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:;Best Offer;;;
TEL;CELL:505
END:VCARD

Every vcard entry begins with BEGIN:VCARD & ends with END:VCARD lines

The command cat * >> contacts.vcf concatenates all the contents of individual vcard files to a single contacts.vcf file which you can import in android.

Comment |
Tags: linux