On Sat, Dec 13, 2008 at 9:20 PM, Tony Mechelynck wrote: > > On 14/12/08 02:57, Robert Mark Bram wrote: >> Thanks Tim, >> >>>> :%s/\(<\/\+p>\)/^M\1^M/g >>>> Simply, it is only replacing the first instance on each line.. can >>> thanks to your \+ requiring one or more "/" characters. I >>> suspect you may be wanting \= instead. >> >> It was that.. plus I had this setting in my .vimrc: >> >> " assume the /g flag on :s substitutions to replace all matches in a >> line: >> set gdefault > > Yeah, I set that at one time in the past but I came back from it. > >> >> >> So all I needed was this: >> :%s/\(<\/\=p>\)/^M\1^M/ >> >>> Alternatively, if you have literal "caret capital-M", instead of >>> a literal control+M (as entered with "control+V control-M), you >>> might use "\r" instead of the "^M". >> >> Btw, I mad the ^M with control+V, ENTER. I thought that was the (a?) >> correct way to get a new line character in the replace section of a >> sed. > > It is one correct way, but neither the simplest nor the easiest (in Vim, > I'm not talking about sed, which I haven't really studied yet).
FWIW, you can use \n in sed. echo a | sed 's/a/a\nb\n/' is equivalent to :s/a\n/a\rb\r/ ~Matt --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
