Note that this will deal with Mary and her little lamb over any line boundaries:
c:\@Work\Perl\monks>perl use strict; use warnings; use autodie; my $data = <<EOD; Mary Had A Little Lamb She Was GOOD Not Changing this Or This Mary Had A Little Lamb She Was GOOD Line 9 Line 10 EOD open my $fh, '<', \$data; my $content = do { local $/; <$fh>; }; print "[[$content]] \n\n"; $content =~ s{ Mary \s+ Had \s+ A \s+ Little \s+ Lamb \s+ She \s+ Was \s+ GOOD } {CHANGED!!!}xmsg; print "<<$content>> \n"; __END__ [[Mary Had A Little Lamb She Was GOOD Not Changing this Or This Mary Had A Little Lamb She Was GOOD Line 9 Line 10 ]] <<CHANGED!!! Not Changing this Or This CHANGED!!! Line 9 Line 10 >>
Give a man a fish: <%-{-{-{-<
In reply to Re: Multiline search and replace in file(s)
by AnomalousMonk
in thread Multiline search and replace in file(s)
by g_speran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |