It took me a while to find it, but "man perlrun" will tell you how to slurp the whole file in one go (-0777)
The /s switch on the search+replace will treat the whole file as one string - ignoring line breaks.
The following will work on most Perl module README files
perl -0777 -nple 's/(SUPPORT.+AND)/$1 PATCHY/s' README
Be careful with greedy matching - that .+ should be .+? if you want the output to be "SUPPORT AND PATCHY DOCUMENTATION". In your case it will match greedily until the last </Directory> unless you add the '?'.
|