I'm using Windows 10 x64, Powershell Core 7.2.6, and /usr/bin/sed (GNU sed) 4.8
installed with Git for Windows. No WSL at all.
I have a .env
file like this.
ENDPOINT="localhost:3000"
and I need to change it to:
ENDPOINT=""
So I'm using this powershell command:
sed -i -e 's/ENDPOINT="localhost:3000"/ENDPOINT=""/g' .env
but it doesn't change the file and there is no error at all.
If I use this instead it works:
sed -i -e 's/ENDPOINT/THIS_WORKS/g' .env
Why?
Maybe the issues are the "
double quotes?
I tried with `" and "" too. No luck!
I tried the suggestion to use:
sed -i -e 's/ENDPOINT=\"localhost:3000\"/ENDPOINT=\"\"/g' .env
but it errors with:
/usr/bin/sed: -e expression #1, char 67: unknown option to `s'
I also tried to reproduce the problem with:
'a', 'ENDPOINT="localhost:3000"', 'b' | sed -e 's/ENDPOINT=\"localhost:3000\"/ENDPOINT=\"\"/g'
The result is:
a
ENDPOINT="localhost:3000"
b