Looking for assistance on how to loop through a list of files, search for a Multiline pattern and Replace the multiline. Below is all I have gotten so far but cant figure out how to match the multiline pattern. Any assistance is appreciated.
my $MODFILE; my @files = <Test*_Copy>; foreach $MODFILE (@files) { # Need to Search and Replace Here #How to Search entire contents of file and Replace??? s/Marry Had A\nLittle Lamb\nShe Was GOOD\n/CHANGED!!!\n/smg; } File Contents (Test1_Copy) Marry Had A Little Lamb She Was GOOD Not Changing this Or This Marry Had A Little Lamb She Was GOOD Line 9 Line 10
In reply to Multiline search and replace in file(s) by g_speran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |