I'm using "GNU sed version 4.2.1", and I'm having issues with "\x" expansion
as folows:
If \x escape sequence in LHS resolves to some character which has special
meaning in sed LHS (like "^", "\", ...), GNU sed does not use it as
hex-escaped, but instead as if it was literaly that character.
For example:
echo 'a^c' | sed -e 's/\x5e/b/'
should produce output "abc" (as it does in "ssed" or "perl -pe"), but in GNU
sed it produces "ba^c".
or,
echo 'a\\c' | sed -e 's/\x5c/b/'
should again produce output "abc", but in GNU sed it terminates sed with error:
"sed: -e expression #1, char 10: Trailing backslash"
(as it interprets it as "sed -e 's/\/b/'" and not as "sed -e 's/\\/b/'")
There are several more such problematic characters.
Proposed solution: all such \xNN escapes should be treated as if the characters
are really escaped, for example '\x5e' in LHS should be treated like '\^' and
not like special-meaning '^'.