
Substituting strings (with newlines) in many files
Hello, I'd like to use
perl -pi.bak -e 's/OLDSTRING/NEWSTRING/g' FILELIST
to replace strings that contain newlines, say I have files
that look like
1
2
3
and I want to make them look like
4
5
6
I'd like to be able to do something like
perl -pi.bak -e 's/1.*3/4\n5\n6/g' *
But that doesn't work without .* being able to match newlines. I
think this is accomplished by setting $* to a nonzero value, but
I'm not sure how to do that on the command line. Multiple -e's
don't seem to work.
Any suggestions?
Thanks,