bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Brokenness in sed -er- fixincludes


From: bkorb
Subject: Re: Brokenness in sed -er- fixincludes
Date: Mon, 17 Nov 2003 19:42:31 +0100

> Hello,
>       thank you for your bug report.
> Sorry that the answer is so late.

No biggie.  Thanks, Stepan.

> On Sun, Oct 26, 2003 at 04:45:44PM -0800, address@hidden wrote:
> > When you join two lines into the pattern space with the 'N'
> > command, an insertion should precede all the text in the
> > current pattern.  It does on every UNIX box I have access to,
> > except for GNU's sed program.
> 
> The GNU sed does the same, in fact.

??  It _is_ GNU's sed I am referring to.

> First, a tricky answer: replace the line
> > cmd='/extern "C\+\+"/N
> with
>   cmd='/extern "C\+\+/N
> and it'll start working. Too much quotes.

No, not too many quotes, but the '\+\+' are meta and are used
to (possibly) repeat the match of the 'C' character.  Very cute.  :)

> And now, a serious answer:  the line should be
>       cmd='/extern "C++"/N
> 
> as sed uses so called basic regular expressions, and + is not a metacharacter.

Ah, now I see why the quote removal works.  :-)

> The behaviour of \+ is _undefined_, says POSIX.  In old implementations, \+ is
> just like +, but in sed, it has special meaning, "repeat at least once", as
> the meaning of + in extended or perl regexps.

I wish we didn't have so many regex syntaxes, ....

> Thats why your script happened to work on some systems, but it may not work
> on other POSIX compliant systems.
> 
> Hope that this explains it.

It seems to work on all POSIX-y seds that I have access to, leaving
GNU's sed anomalously correct.  I'll fix fixincludes.  Thank you.
Regards, Bruce




reply via email to

[Prev in Thread] Current Thread [Next in Thread]