GNU bug report logs -
#73598
bug in sed Invalid preceding regular expression
Previous Next
Full log
View this message in rfc822 format
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.