GNU bug report logs - #20571
sed 4.2.2

Previous Next

Package: sed;

Reported by: Massimo Masotti <max.mas <at> libero.it>

Date: Thu, 14 May 2015 09:17:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


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#20571: sed 4.2.2
Date: Thu, 14 May 2015 12:28:41 +0200
On Thu, 14 May 2015 10:19:43 +0200 (CEST), Massimo Masotti
<max.mas <at> libero.it> wrote:

> Good morning,
> 
> the file contains "8.25F, \n". I notice a strange behavior with this line:
> 
> sed -i -r 's/([0-9])F([,; \]\}\)])/\1\2/g'  file
> 
> while I'm expecting to get "8.25, \n", the content is not changed. To get
> the expected substitution, I must use:
> 
> sed -i -r 's/([0-9])F([,; \}\)])/\1\2/g'  file
> 
> as if it is not legal to use the escaped character  ']'.

If you want to use a "]" inside a bracket expression, specify it as the
very first character (after the ^ negation, if present, but that's not
your case). And you don't need to escape } and ) inside the bracket
expression, so

sed -i -r 's/([0-9])F([],; })])/\1\2/g'  file

Here what's inside the [] is 

],; })


-- 
D.




This bug report was last modified 10 years and 92 days ago.

Previous Next


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