I wan to replace a specific IP to another so say localhost to 0.0.0.0
sed -i -e 's/localhost/0.0.0.0/g'
doesn't seem to work
also tried sed -i -e 's/localhost/0\.0\.0\.0/g'
doesnt work either
sed: RE error: illegal byte sequence
I wan to replace a specific IP to another so say localhost to 0.0.0.0
sed -i -e 's/localhost/0.0.0.0/g'
doesn't seem to work
also tried sed -i -e 's/localhost/0\.0\.0\.0/g'
doesnt work either
sed: RE error: illegal byte sequence
Your examples seem to work fine for me. Given the following test.txt
ip=localhost
The following replaces the entire ip=localhost
with 0.0.0.0
sed -i -e 's/ip=localhost/0\.0\.0\.0/g' test.txt
If you just want the localhost
part replaced:
sed -i -e 's/localhost/0\.0\.0\.0/g' test.txt
will give you the following:
ip=0.0.0.0