Hello Paul, * Paul Eggert wrote on Sat, Jan 05, 2008 at 09:24:46AM CET: > Ralf Wildenhues <[EMAIL PROTECTED]> writes: > > > If & is used as sed s delimiter, then escaping & in the RHS right is > > tricky (portably), as it's now both delimiter and replacement > > operator, and literal. > > I don't see why it's tricky to do portably. If the RHS contains '&', > escape it with a backslash. That's simple and portable, no?
But it doesn't work the way it should. Sorry, I should have given an example: With GNU sed 4.1.5, echo x | sed 's&x&ab\&c&' results in abxc rather than ab&c which is what is returned by the seds on AIX, BSDs, Solaris, IRIX, Tru64, and reading SUSv3, I think it does not specify which is right. > The advantage of using & as a delimiter is that any other choice of a > delimiter means one more character to escape (namely, the delimiter). > > (Admittedly these are all minor points.) Cheers, Ralf
