|
From: | Paolo Bonzini |
Subject: | Re: [PATCH 1/3] Properly expand @configure_input@ in config.status. |
Date: | Sat, 05 Jan 2008 19:36:53 +0100 |
User-agent: | Thunderbird 2.0.0.9 (Macintosh/20071031) |
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.
Yes, it is undefined and the current behavior is more coherent with what is done on the LHS of the `s' command. There, you want to strip slashes or the following command
s/a\/b//will rely on the regex matcher matching a literal slash for the escape \/. This behavior changed in 4.1.x as part of a general reorganization of the sed parser to better support 7-bit multibyte character sets (e.g. ISO-2022) in the sed commands. In the command above, sed sees
s&x&ab\&c& as if it was: s/x/ab&c/The same behavior applies to the LHS: backslashed items are *not* passed down to the regex matcher. For example, in
s|a\|b||older (up to 4.0.x) GNU seds will parse \| as a special escape (alternation) but 4.1.x and non-GNU seds will parse it as a literal pipe.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |