I am trying to update a configuration file value. My configuration has got following value:
Code:
"mailhost": ["20.20.20.1", 25],
I want to change the value 20.20.20.1 only excluding rest characters to something to 30.30.30.1. I have following script lines which I came up with:
Code:
sudo sed -i 's/\("mailhost": ["\).*\(, 25]\)/\1 "'30.30.30.1'" \2/g' mymy.conf
I get "
sed: -e expression #1, char 52: invalid reference \2 on `s' command's RHS" message." syntax error message.
Can anyone help me please?
I also tried using following syntax (got by searching in google) but still the error message is same.
Syantx example(GOOGLE):
Code:
sed 's/\(*string1\).*\(string3.*\)/\1string2\2/' mymy.txt
The syntax which i used
Code:
sudo sed 's/\(*"mailhost": ["\).*\(", 25],.*\)/\1"30.30.30.1"\2/' mymy.conf
Thanks