On Mon, Mar 31, 2014 at 5:54 PM, Daniel Peyrolon <tucha...@gmail.com> wrote: >> Edit , x/^[^ ]+[ ]*[^(]*\([^)]*\)[ ]*\{[ ]*\n/ s/[ ]*\{[ ]*\n/\n\{/g > > So, it was simply a matter of changing "$" for "\n" at the x command!
Yes. (In the version I gave, the replacement of the second $, the one in the s command, by \n was superfluous.) > How come my command didn't work? > It really should work with the "$", shouldn't it? In the original version, the x command matches up to the end of the line, but the resulting selection is no longer itself a line; so the subsequent s command, trying to match various things and then the empty string at the end of a line ($), does not succeed. But replacing, in the x command, the $ by \n leaves the result of a match (now one character longer because it includes the \n) a line, in which the s command then successfully matches $. As ever, Mark.