Subject: Re: bug#20572: bug about sed when use -i

From: Jim Meyering <[email-masked]>
Date: Thu, 14 May 2015 08:16:10 -0700

tags 20572 moreinfo
thanks

On Thu, May 14, 2015 at 2:00 AM, Lu Qin <[email-masked]> wrote:
> when I use sed like this :
>
> sed -i  -e 's/\(public class TInfo .*\)$/\1\
> \
>   private static final long serialVersionUID = -4659975753252858243l; \/\/ See ACCUMULO-3132\
> /' src/main/java/org/apache/accumulo/trace/thrift/TInfo.java
>
> It will create a file name TInfo.java-e as a backup,but the -e is not the backup extension I use.
>
>
> If I use it like this:
> sed -i ''  -e 's/\(public class TInfo .*\)$/\1\
> \
>   private static final long serialVersionUID = -4659975753252858243l; \/\/ See ACCUMULO-3132\
> /' src/main/java/org/apache/accumulo/trace/thrift/TInfo.java
>
> It will be work ok and not create a backup file what I want.

I think Davide's guess that you are using some other version of sed is right.
Please tell us what "sed --version" prints.

If you are using some version of GNU sed it must be out of date;
repeat your test using the latest: sed-4.2.2 and let us know.