I would like to replace a string with another string. For example: I would like to change the following text:
"listen_addresses = ['127.0.0.1:53', '[::1]:53']"
to the following text
"listen_addresses = ['127.0.0.1:40', '[::1]:40']"
I tried this command:
sudo sed "s#listen_addresses \= \['127\.0\.0\.1\:53'\, '\[\:\:1\]\:53'\]'#listen_addresses \= \['127\.0\.0\.1\:40'\, '\[\:\:1\]\:40'\]#g"
and I got this result:
input: listen_addresses = ['127.0.0.1:53', '[::1]:53']
output: listen_addresses = ['127.0.0.1:53', '[::1]:53']
What am I doing wrong?
[
and]
, and in first part of replacement.