[vox-tech] Regexp Question

Troy Arnold vox-tech@lists.lugod.org
Thu, 8 Jan 2004 15:48:06 -0800


On Thu, Jan 08, 2004 at 03:05:25PM -0800, Richard Crawford wrote:
> I'm writing a Perl script which will go through all of the files in a
> directory and delete all of the text between <FORM and RESET>.  In each
> file, there are about ten lines of text between the two strings.  This has
> been breaking my head for a couple of hours now.  Anyone got any
> suggestions?

if the <form> and <reset> are on their own lines:

perl -i -e 'while (<>){
$form++,print if /FORM/;
$reset++ if /RESET/;
print unless ($form && !$reset);
}'  *.html

otherwise:

have fun!
:)