Convert Massive VCard file into individual files

From Michael's Information Zone
Revision as of 12:29, 21 February 2018 by Michael.mast (talk | contribs) (Created page with "Apple would export MacOS contacts in vcard format, but only as a single file. Below pulls these out as individual files for importing into other programs that do not support t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Apple would export MacOS contacts in vcard format, but only as a single file. Below pulls these out as individual files for importing into other programs that do not support this master file format (ie MS Outlook).

contact="1";while read line; do if ! grep -q "END:VCARD" <<<$line ; then echo $line >> contact_$contact.vcard; elif grep -q "END:VCARD" <<<$line; then echo "$line" >> contact_$contact.vcard; contact=$((contact + 1));fi;done < master.vcard


If you want to convert this list into a CSV file that can be used by Outlook there are two ways to do this.

  1. Import into Windows Contacts first, then export as CSV[1]
  2. Write a script for converting each file into CSV format. This would be best but I am doing what I can to ensure compatibility with crazy MS Outlook. Will revisit later.
    1. https://www.msoutlook.info/question/726