GNU bug report logs - #73598
bug in sed Invalid preceding regular expression

Previous Next

Package: sed;

Reported by: Peter Smulders <p.j.m.smulders <at> home.nl>

Date: Wed, 2 Oct 2024 13:00:03 UTC

Severity: normal

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#73598: bug in sed Invalid preceding regular expression
Date: Wed, 2 Oct 2024 15:23:03 +0200
On Wed, 2 Oct 2024 11:59:09 +0200, Peter Smulders <p.j.m.smulders <at> home.nl>
wrote:

> I expect the command line
>
> echo ****some string | sed s/\*\*\*\*//
>
> to strip the *'s and result in
>
> some string
>
> However I get the error message:
>
> sed: -e expression #1, char 8: Invalid preceding regular expression
>
> -----
>
> When the sed command is taken from a file it works as expected:
>
> $ echo ****some string | sed -f script
> some string
>
> where file script consists of the line
> s/\*\*\*\*//
>

In the command line version, the shell is stripping away your backslashes.
So you want:

echo ****some string | sed 's/\*\*\*\*//'

--
D.




This bug report was last modified 248 days ago.

Previous Next


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