in reply to How can I match a multi-line regexp?

If you want to do a quick in-place edit of a bunch of files, you can use this syntax:

perl -pi.bak -e 'undef $/; s/line1\nline2/new content/' files ..

This will create ".bak" files for every file it operates on. NOTE that it won't find any matches on the first line. If someone knows another one-liner that also matches on the first line, I'm interested to see it. :)

Replies are listed 'Best First'.
Re: Answer: How can I match a multi-line regexp?
by Anonymous Monk on Jul 17, 2003 at 16:31 UTC
    what is the effect of undef $/; ?