#!/usr/bin/perl $d = 1 ; while (<>) { # start $x = 0 ; if (/^BEGIN:VEVENT/) { if ($d) { print "$x: $_" ; } do { $x++ ; $line = <> ; if ($d) { print "$x: $line" ; } if ($line =~ /SUMMARY:Peski/) { $err = 1 ; } $seg .= $line ; } until ($line =~ /^END:VEVENT/) ; if (! $err) { $output .= $seg ; } next ; } $seg = "" ; $output .= $_ ; } print $output