[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed vs gnu sed
On Tue, Jun 11, 2002 at 06:01:26PM +0200, fransoa holop wrote:
> hi,
>
> i am suffering w/this stupid mistake.
> i'd like to substitute every space(s) (1 or more)
> in a string with one ':'
> man re_format says + is for 1 or more atoms:
>
> amaaq> echo "1 2 3" | sed -e 's| +|:|g'
> 1 2 3
> amaaq> echo "1 2 3" | sed -e 's| \+|:|g'
> 1 2 3
>
> gnu sed works w/the last version. is this normal
> or a bug in `our' sed?
sed in OpenBSD use basic regular expression. See re_format(7) for
regex syntax and the difference between basic and extented.
As the man page says, + and ? are not available in basic regex in
OpenBSD.
You may use the \{1,\} syntax to replace + functionnality.
In gnu sed, if I remember, all extented regex functionnality is
available in basic regex through escaping (\) the special chars.
I don't known if that's wrong but I've been counting on that a lot
too.
>
> -f
> --
> i'm so modest i pull the curtains before changing my mind.
--
Hugo Villeneuve <hugo@EINTR.net>
http://EINTR.net/