> I'm trying to write a perl one-liner that will edit an iCalendar
> format file to remove To Do items.  The file contains several
> thousand lines, and I need to remove several multi-line blocks.  The
> blocks to remove start with a line "BEGIN:VTODO" (without the quotes)
> and end with a line "END:VTODO" (also without quotes).
> 
> I've tried the following one-liner,
> 
> perl -p -i.bak -e 's/BEGIN:VTODO.*END:VTODO//sg' file_name_to_edit

Assuming you have enough disk space:

perl -ane 'print unless /^BEGIN:VTODO/ .. /^END:VTODO/' old > new

perldoc perlrun for more info on perl's command line paramaters

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to