Match parameter in file and replace tonly he value after equals character

on the following example file more ambari-agent.ini [server] hostname=AABB we want to match hostname word in file and replace only the value after = ( equals character ) so we did that VAR=server_100 sed -ire “s/(hostname=)[^=]*$/\$VAR/” /tmp/ambari-agent.ini but still we have more ambari-agent.ini [server] hostname=AABB while expected results should be more ambari-agent.ini [server] hostname=server_100 where…

Details