#!/usr/bin/perl -w # (c) 2005 Christoph Berg # All rights reserved. # This program is free software licensed under the terms of the GNU GPL v2. use strict; my ($card, $fn, $bday, $cat); while (<>) { $card = 1 if /^BEGIN:VCARD/; next unless $card; $fn = $1 if /^FN:(.*)/; $bday = $1 if /^BDAY:(\d+)/; $cat = $1 if /^CATEGORIES:(.+)/; if (/^END:VCARD/) { if ($fn and $bday and (not $cat or $cat !~ /\bx\b/)) { if ($bday =~ /(\d{4})(\d{2})(\d{2})/) { my ($yy, $y, $m, $d) = ($1, $1, $2, $3); $yy = (localtime)[5] + 1900 if $y < 1970; print "$m/$d/$yy 99:99:99 0:0:0 0:0:0 0:0:0 ---------- 0 0\n"; print "R\t0 0 0 0 1\n"; if ($y > 0) { print "N\t$fn *$y\n"; } else { print "N\t$fn\n"; } } } undef $fn; undef $bday; undef $cat; $card = 0; } }