title: Use sed to edit a value within quotes
body: <p>xI have a text in this form:</p>
  
  <pre><code>foo1   bar1   xId "myId1";yId "something"
  foo2   bar2   xId "myId2";yId "something"
  foo2   bar2   yId "something";xId "myId3"
  </code></pre>
  
  <p>How can I use sed to edit the myId field? I want to append a value before it, like this:</p>
  
  <pre><code>foo1   bar1   xId "prefix_myId1";yId "something";
  foo2   bar2   xId "prefix_myId2";yId "something";
  foo2   bar2   yId "something";xId "prefix_myId2";
  </code></pre>
  
  <p>I cannot use awk because xId is not always in the same place in my file. However, it is guaranteed that the line is in this format:
  someStuff  xId "myContent"; someOtherStuff </p>
  
  <p>Thanks a lot, I can use </p>
  
  <pre><code>sed 's/\(.*xId \)[^ ]*\(;.*\)/ a \1"newValue"\2/'
  </code></pre>
  
  <p>but it replaces the contents by newValue instead of prefixing it...</p>
  
  <p>The capture group should make use of xId</p>
  
  <p>EDITED TO SHOW TRICKY PART, THANKS FOR YOUR COMMENTS</p>