GNU bug report logs - #23493
gnu sed word replace bug

Previous Next

Package: sed;

Reported by: xingzx <richshaw <at> 126.com>

Date: Mon, 9 May 2016 17:19:03 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23493 in the body.
You can then email your comments to 23493 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-sed <at> gnu.org:
bug#23493; Package sed. (Mon, 09 May 2016 17:19:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to xingzx <richshaw <at> 126.com>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Mon, 09 May 2016 17:19:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: xingzx <richshaw <at> 126.com>
To: bug-sed <at> gnu.org
Subject: gnu sed word replace bug
Date: Tue, 10 May 2016 01:02:35 +0800
[Message part 1 (text/plain, inline)]
Hello:
	I’m not sure whether it’s gnu sed’s bug, but it just behaves  different with Mac OS X :

gnu sed(/usr/local/bin/sed (GNU sed) 4.2.2):
~ $ echo '<WebCore/DOMElement.h>'| /usr/local/bin/sed -E 's/\<WebCore\//\<WebKitLegacy\//'
<<WebKitLegacy/DOMElement.h>

Mac 10.11.3 sed(/usr/bin/sed):
~ $ echo '<WebCore/DOMElement.h>'| /usr/bin/sed -E 's/\<WebCore\//\<WebKitLegacy\//'
<WebKitLegacy/DOMElement.h>

[Message part 2 (text/html, inline)]

Information forwarded to bug-sed <at> gnu.org:
bug#23493; Package sed. (Mon, 09 May 2016 21:18:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Davide Brini <dave_br <at> gmx.com>
To: bug-sed <at> gnu.org
Subject: Re: bug#23493: gnu sed word replace bug
Date: Mon, 9 May 2016 23:17:04 +0200
On Tue, 10 May 2016 01:02:35 +0800, xingzx <richshaw <at> 126.com> wrote:

> Hello:
> 	I’m not sure whether it’s gnu sed’s bug, but it just behaves
> different with Mac OS X :
> 
> gnu sed(/usr/local/bin/sed (GNU sed) 4.2.2):
> ~ $ echo '<WebCore/DOMElement.h>'| /usr/local/bin/sed -E
> 's/\<WebCore\//\<WebKitLegacy\//' <<WebKitLegacy/DOMElement.h>
> 
> Mac 10.11.3 sed(/usr/bin/sed):
> ~ $ echo '<WebCore/DOMElement.h>'| /usr/bin/sed -E
> 's/\<WebCore\//\<WebKitLegacy\//' <WebKitLegacy/DOMElement.h>

No bug, in GNU sed, \< and \> are special and get interpreted, while on
OSX sed the \ in the \< combination is silently stripped. 
So if you just want to match a literal lesser sign, just use it unescaped
(and in any case, you surely don't have to escape it in the replacement
part):

$ echo '<WebCore/DOMElement.h>'| sed -E 's/<WebCore\//<WebKitLegacy\//'
<WebKitLegacy/DOMElement.h>

-- 
D.




Information forwarded to bug-sed <at> gnu.org:
bug#23493; Package sed. (Mon, 09 May 2016 22:00:02 GMT) Full text and rfc822 format available.

Message #11 received at 23493 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Davide Brini <dave_br <at> gmx.com>
Cc: 23493 <at> debbugs.gnu.org
Subject: Re: bug#23493: gnu sed word replace bug
Date: Mon, 9 May 2016 14:59:07 -0700
tags 23493 notabug
close 23493
done

On Mon, May 9, 2016 at 2:17 PM, Davide Brini <dave_br <at> gmx.com> wrote:
> On Tue, 10 May 2016 01:02:35 +0800, xingzx <richshaw <at> 126.com> wrote:
...
> No bug, in GNU sed, \< and \> are special and get interpreted, while on
> OSX sed the \ in the \< combination is silently stripped.
> So if you just want to match a literal lesser sign, just use it unescaped
> (and in any case, you surely don't have to escape it in the replacement
> part):
>
> $ echo '<WebCore/DOMElement.h>'| sed -E 's/<WebCore\//<WebKitLegacy\//'
> <WebKitLegacy/DOMElement.h>

Thanks again for responding, Davide.
With the directives above, I've marked this as a non-bug and closed
the auto-created issue.




Added tag(s) notabug. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 24 Jan 2017 23:33:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 23493 <at> debbugs.gnu.org and xingzx <richshaw <at> 126.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 24 Jan 2017 23:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 22 Feb 2017 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.