Oof. Ok, maybe I should give my *real* case. I have some directories with a bunch of Java files that contain this comment: /** * @version 1.0 * @author */ I want to remove this comment from all of the files. Thoughts? - Jared On Monday 25 March 2002 02:16 pm, you wrote: > On Mon, Mar 25, 2002 at 01:19:36PM -0600, Jared Burns wrote: > > I've got a file containing the text: > > blah > > grah > > > > and I want to replace those two lines with the string: > > broohaha > > > > I've tried using: > > perl -pi -e 's/blah\ngrah/broohaha/' file > > > > I've also tried: > > perl -pi -e 's/blah\ngrah/broohaha/s' file > > perl -pi -e 's/blah\ngrah/broohaha/m' file > > perl -pi -e 's/blah\ngrah/broohaha/ms' file > > > > all with no success. What am I doing wrong? How do I replace a string > > that spans multiple lines? > > I don't think you can do multi-line regexps with a one-liner call > of perl. The one-liner way of calling perl reads in your file > line by line and acts on it, so its not able to match multi-line > regexps. Look at the perlrun man page (and in particular the -e > and -i options). So I think you'll have to turn this into a simple perl > script to get it work or use sed.