title: replacing values in shell script using sed
body: <p>My shell script looks like this:</p>
  
  <pre><code>FAILED_REQUEST_DIRECTORY=/bla/bla2 java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1234  -jar /xyz/abc-service-1.0-SNAPSHOT.jar --server.port=1111 --server.address=127.0.0.1 --kafka.bootstrap.servers=10.111.11.11:3197,10.112.12.111:3197,10.123.44.25:3197 --topic.pushcrew.encryptionKey=abc-def-egh --spring.application.name=name-sevice  --fb.verification.token=token --management.trace.include.payload=true --topic.pushcrew.hits=activity-logs --max.block.ms=1000 --pager.duty.api.key=apikey --dsn=dsn
  </code></pre>
  
  <p>If I have to replace values of keys in the command, for ex: replacing value of key <code>--server.address</code> with the value to shell script through a variable, how would I do it?</p>
  
  <p>I understand it would look like following if I had to replace value for key --server.address:</p>
  
  <pre><code>sed -i "s#--server.address=.* #$SERVER_ADDRESS#g;
  </code></pre>
  
  <p>But how do I maintain the space that has to be there after the replacement and how do I make sure that part int the key only after <code>=</code>(equals to) and before  <code></code> (space) gets replaced.</p>