syncevolution/test/normalize_vcard.pl
Patrick Ohly a42a23b9c6 added testing of syncing
git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@12 15ad00c4-1369-45f4-8270-35d70d36bdcd
2005-12-10 19:16:02 +00:00

23 lines
529 B
Perl
Executable file

#! /usr/bin/perl -w
use strict;
$_ = join( "", grep( !/^(BEGIN:VCARD|VERSION|END:VCARD|UID:)/, <> ) );
s/\r//g;
my @cards = ();
foreach $_ ( split( /\n\n/ ) ) {
# undo line continuation
s/\n\s//gs;
# ignore charset specifications, assume UTF-8
s/;CHARSET="UTF-8"//g;
# ignore extra email type
s/EMAIL;TYPE=INTERNET/EMAIL/g;
# sort entries, putting "N:" first
my @lines = split( "\n" );
push @cards, join( "\n", grep( /^N:/, @lines ), sort( grep ( !/^N:/, @lines ) ) );
}
print join( "\n\n", sort @cards );