fork(1) download
  1. #!/bin/bash
  2. s="key = oldValue
  3. key=oldValue
  4. key= oldValue
  5. key =oldValue
  6. keyABC = doNotMatchThis"
  7.  
  8. sed '/^key *=/s/=.*/= newValue/' <<< "$s"
Success #stdin #stdout 0s 4288KB
stdin
Standard input is empty
stdout
key = newValue
key= newValue
key= newValue
key = newValue
keyABC = doNotMatchThis