Linux – Execute the Sed command

Execute the Sed command… here is a solution to the problem.

Execute the Sed command

When I run the command

sed -e "s/$1/@root@The-Three-Little-Pigs-Siri-Proxy/" -i

I get the following error. I’m trying to replace the text $1 with another one below in the same file, instead of creating a new one, just modifying the current one.

sed: -e expression #1, char 0: no previous regular expression

Any ideas that could lead to errors and how to fix it?

Operating system: Ubuntu 10.10 32-bit


$1 If it is a double-quoted string, it will be expanded to an empty string (‘').
You can use single quotes to keep the literal value of $1:

sed -e 's/$1/@root@The-Three-Little-Pigs-Siri-Proxy/' -i

Related Problems and Solutions