In article <[EMAIL PROTECTED]> you wrote: > is there a way to match a pattern over more then one line in vi (i normally > use vim)? > > i'm html formatting text documents and what i'd like to do is replace > something like the below paragraphs: > ______________________________________________________________________ > > the first line of text, this is really boring, blah lah blh why do i > care. html formatting text is really boring and vi saves me. > > the is a second line of text. > ______________________________________________________________________ > > with something like this > > ______________________________________________________________________ > > <p> the first line of text, this is really boring, blah lah blh why do i > care. html formatting text is really boring and vi saves me. > > <p> the is a second line of text. > ______________________________________________________________________
So add <p> to any non-blank line? I'd like to know a one-liner for this too. You've got blank line with ^$ but how do you negate that? A two-liner is %s/^/<p>/ - add <p> to the start of each line %s/^<p>$// - remove any lines that contain only <p>