On Thu, 8 Jan 2004, 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?
#!/usr/bin/perl -w
use strict;
$/=''; # no record separator
my $x = <>; # process stdin to a single string
$x =~ s/<FORM.*?RESET>//sg; # substitute nothing where the minimal match
# occurs, disregard newlines, repeat
# throughout entire string
print $x; # ship result to stdout
works regardless of where in the lines the form and reset tags are.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<[EMAIL PROTECTED]> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...2k
---------------------------------------------------------------------------
_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech