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

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

Re: GNU sed version 4.2.1 bug?


From: Paolo Bonzini
Subject: Re: GNU sed version 4.2.1 bug?
Date: Fri, 8 Apr 2011 15:54:26 +0200

On Wed, Apr 6, 2011 at 17:59, Joshua Schriver <address@hidden> wrote:
> I have a line in a script:
>
>                sed -ire 's:([^\\]*)\\(.*):<\1 >\n\2\n</\1 >:g' tmpfile
>
> That gives the following error:
> sed: -e expression #1, char 36: invalid reference \2 on `s' command's RHS
>
> When I'm using the -I option.
> Changing the line to the following works without errors:
>                sed -re 's:([^\\]*)\\(.*):<\1 >\n\2\n</\1 >:g'  tmpfile > 
> tfile2
>
> Why would the in-place option make or break the replacement expression?

"re" is being taken as the backup suffix.  Use "-i -re".

Paolo



reply via email to

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