Replace
Code:
sed -e 's/rcon_password "*"/rcon_password "bar"/g' server.cfg > server1.cfg
With
Code:
sed '/rcon_password/s/foo/bar/g' server.cfg > server1.cfg
How it works?
Above sed will substitute "foo" with "bar" ONLY for lines which contain "rcon_password"