Difference between revisions of "Convert Massive VCard file into individual files"

From Michael's Information Zone
Jump to navigation Jump to search
(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...")
 
 
Line 1: Line 1:
 
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).
 
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).
 
<pre>
 
<pre>
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
+
contact="1";while read line; do if ! grep -q "END:VCARD" <<<$line ; then echo $line >> contact_$contact.vcf; elif grep -q "END:VCARD" <<<$line; then echo "$line" >> contact_$contact.vcf; contact=$((contact + 1));fi;done < master.vcard
 
</pre>
 
</pre>
 
<br>
 
<br>

Latest revision as of 13:58, 21 February 2018

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.vcf; elif grep -q "END:VCARD" <<<$line; then echo "$line" >> contact_$contact.vcf; 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