summary: top
vcf2csv is a command line tool to convert vcard files to html or csv. Thus you may call it vcf2html also.
The input source is a regular file and the output is written to stdout.

The program is written in ANSI-C and should be compiled smoothly on most systems.

This project is under heavy development.

PLEASE NOTE:
vcf2csv is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

vcf2csv is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with vcf2csv. If not, see <http://www.gnu.org/licenses/> .

how it works:

The output is generated in two steps:

First, the whole input file is parsed to identify all used types in all vcards. A type is a data field like "CLASS", "EMAIL", "ADR;TYPE=home" and so on. Thus all used types do appear in the output.

Second, the file is parsed again: each particular vcard included in the file is read.
Once all values of this vcard are assinged to their corresponding type, it is written to stdout immediately.

While reading the values there may be done some conversions: as described in rfc2426 (2.6) a line "[...] longer than 75 characters SHOULD be folded according to the folding procedure described in [MIME DIR]."
If a folded line is detected, the new line characted '\n' is converted to the text value "\n".

If you want to ommit some types you can use a drop list. For example:
vcf2csv -d 'ADR;,PHOTO;VERSION;' -i vcards.vcf -w > output.html
This example ommits all types containing the string "ADR;", "PHOTO;" or "VERSION;" and creates a simple html file displaying your vcards in a table, each by a single row.
requirements: top
On most GNU linux sytems you can use the binary provided by the download archive.
Otherwise you need
license: top
GPL v3 (or any later version).
You should have received a copy of the GNU General Public License along with vcf2csv. If not, see <http://www.gnu.org/licenses/> .
usage and screenshots: top
vcf2csv -[hvw] -i <file>

optiondescription
-d LIST comma separated list of types to drop, e.g. -d 'ADR;TYPE=,X-KPILOT,PHOTO;,LABEL;TYPE=work'
The contents of the list are handled case sensitive.
If a content of this list is a substring of a type, this type is dropped.
-h print help
-i <file> input file (required)
-v print version
-w web output, create html instead of csv


The easiest way to use it for web output is to create an alias:
alias vcf2html="</path/to/bin/vcf2csv -w"
Now you simply call this alias, for example like this:
vcf2html -i my.vcf > my.html


Examples:

convert vcard.vcf to csv, write output to out.csv:

vcf2csv -i vcard.vcf > out.csv

Here you see a sample result:
example csv output


convert vcard.vcf to html file out.html:

vcf2csv -w -i vcard.vcf > out.html

Here you see a sample result using vcf2csv.css (provided by package) for page formatting:
example html output


Use a drop list to strip TYPEs:
If you want to prevent some types to be converted, the are specified by a drop list. For example, a PHOTO uses a lot of space an should not apper in the resultig csv list. In this case use '-d' to drop all types containing the string PHOTO:
vcf2csv -d PHOTO -i vcard.vcf > out.csv


The drop list is a comma separated list of values. It is handled case sensitive and may be a substring of the type to drop.

Let's take a look for a more complex example:
you want to drop all types containing the substring x-, all photos and all addresses of the type home.
A vcard stores this information in these types:
X-KADDRESSBOOK-X-IMAddress:www.somepage.com
X-KADDRESSBOOK-X-SpousesName:somename
ADR;TYPE=home:some;private;;address;information
PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQSkZJRgABAQIAA.....


All you have to know are the strings in front of the colon.
Here you see a command line to generate a simple web page and drop these types:
vcf2csv -w -d 'X-,ADR;TYPE=,PHOTO;' -i vcard.vcf > out.html
contact: top
feel free to contact me.
(remove <no spam> and spaces from address)
links: top
SourceForge project page http://sourceforge.net/projects/vcf2csv/
Download vcf2csv from SourceForge https://sourceforge.net/project/platformdownload.php?group_id=223241
changes: top
version 0.0.4 Bugfixes:
  • none
Changes:
  • man page added
  • install/remove via make
version 0.0.3 Bugfixes:
  • unnecessary space removed from line folded lines
  • segmentation fault if photo is included
Changes:
  • new option -d to drop vcf keys