|
From: Doug R. <df...@nl...> - 2004-01-05 20:12:03
|
On Mon, 2004-01-05 at 16:59, Jeremy Fitzhardinge wrote:
> On Mon, 2004-01-05 at 03:37, Doug Rabson wrote:
> > I think the key problem was the use of '\1' but I didn't realise that
> > until I started messing around with -E (which selects an alternative
> > regexp expression syntax). It should be possible to come up with
> > something that works on both versions of sed.
>
> Well, both versions of sed support a more complete regex syntax than
> normal sed, but they seem to do it incompatibly. GNU sed uses a lot
> more \'s, and BSD sed uses -E. We could just weaken the regexps until
> they're representable in standard sed regex syntax, but that seems like
> giving up.
The closest I can come to a regexp which works in BSD sed using the
"obsolete" regexp syntax is:
sed "s/[=-\+\*]\{2,2\}[0-9]\{1,5\}[=-\+\*]\{2,2\} //"
The main problem is that '\|' (e.g. '\(a\|b\)') isn't supported in the
obsolete syntax. It is supported in extended syntax but without as many
backslashes, (e.g. '(a|b)'). How wretched - maybe it would be better to
use perl after all.
|