I am trying to replace matching string with other string. This is what I haveZKHOSTS=host1,host2,host3old_string=tsd.storage.hbase.zk_quorum*new_string=tsd.storage.hbase.zk_quorum = $ZKHOSTSsed -i '/$old_string/c\$new_string' /etc/opentsdb/opentsdb.confwhich isn't working as excepted.I even tried following sed -i 's/$old_string/$new_string/g' /etc/opentsdb/opentsdb.confsed -i '/${old_string}/${new_string}/g' /etc/opentsdb/opentsdb.confI dont know what wrong I am doing here.
sed replace with variable
centos;sed;string
You must use double quotes, like:sed -i s/$old_string/$new_string/g /etc/opentsdb/opentsdb.conf