#!/usr/bin/perl -w # (c) 2005, 2007 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); my ($d0, $m0) = (localtime)[3,4]; $m0++; my @out; 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/)) { next unless ($bday =~ /(\d{4})(\d{2})(\d{2})/); my ($y, $m, $d) = ($1, $2, $3); next unless ($m == $m0 and $d == $d0); push @out, "$fn". ($y > 0 ? " ($y)" : ""); } undef $fn; undef $bday; undef $cat; $card = 0; } } print join ", ", @out;