I have a conf file like:
mon host = 1.1.1.1
cluster = test
I want to write new ip end of "mon host" like:
mon host = 1.1.1.1, 2.2.2.2
cluster = test
How can i do that?
You can easily do it with sed
:
sed '/^mon host =/ s/$/, 2.2.2.2/' your.conf
Use -i
to change the file instead of printing to STDOUT.