vcf file normalization by email
news2014-01-17-convert-vcf-files

This little perl file is to convert unique UIDs of VCards into mail=... which is where the claws mail program finds duplicates.

#!/usr/bin/perl

open(FILE, '2014-01-17.vcf');
my $content = join('', <FILE>);
close(FILE);

sub found()
{
        my $vcard = $1;
        if($vcard =~ /^EMAIL.*:(.+)rn/m)
        {
                my $mail = $1;
                $vcard =~ s/UID:.*/UID:mail=$mail\,ou=people\,dc=typesafe\,dc=de/g;
        }
        print qq[$vcardrnrn];

}
$content =~ s/(BEGIN:VCARD.*?END:VCARD)/found/gmes;
top