title: sed to replace only matching part in search string
body: <p>I have a file that contains:</p>
  
  <blockquote>
    <p>Lorem ipsum dolem file1.jar.</p>
    
    <ul>
    <li>file1.jar (MD5: 12345678901234567890123456789012)</li>
    <li>file2.jar (MD5: 09876543210987654321098765432109)</li>
    <li>file3.jar (MD5: 24681357902468135790246813579024)</li>
    </ul>
  </blockquote>
  
  <p>and I'd like to replace the first MD5. This <code>sed</code> command does the job:</p>
  
  <pre><code>sed "s/file1.*MD5\:\(.*\)/file1.jar \(MD5\: `md5 file1.jar | awk '{print $4}'`\)/"
  </code></pre>
  
  <p>Is there a way to tell <code>sed</code> to replace only the matching group while leaving the rest of the line alone? For example:</p>
  
  <pre><code>sed "s/file1.*MD5\:\(.*\)/`md5 file1.jar | awk '{print $4}'`/"
  </code></pre>