[nylug-talk] need sed help

Eric Moore eemoore at fyndo.com
Tue Apr 3 22:38:17 EDT 2007


"Peter C. Norton" <spacey-nylug at lenin.net> writes:

> Ahhh, lovely. That reversal of the usual meaning of "escape" is
> wonderful.

Well, the original sed didn't do +, to do x+ instead you needed to do
xx* so for backwards compatibility GNU sed allows the +, but requires
it to be escaped.  POSIX specifies the x\{1,\} syntax, and that works
in GNU sed, without the -r switch as well.  The -r switch activates
the POSIX extended regular expressions, which include + as a special
character.  The GNU sed behavior of \+ is legal under POSIX, because
the behavior of any escaped (ordinary) character besides one of ) ( }
{ or 1-9 is undefined.

You are in a maze of twisty little regexp syntaxes, all different.

> -Peter
-- 
Eric


More information about the nylug-talk mailing list