title: sed: Replace part of a line
body: <p>How can one replace a part of a line with sed?</p>
  
  <p>The line </p>
  
  <pre><code>DBSERVERNAME     xxx
  </code></pre>
  
  <p>should be replaced to:</p>
  
  <pre><code>DBSERVERNAME     yyy
  </code></pre>
  
  <p>The value xxx can vary and there are two tabs between dbservername and the value. This name-value pair is one of many from a configuration file.</p>
  
  <p>I tried with the following backreference:</p>
  
  <pre><code>echo "DBSERVERNAME    xxx" | sed -rne 's/\(dbservername\)[[:blank:]]+\([[:alpha:]]+\)/\1 yyy/gip'
  </code></pre>
  
  <p>and that resulted in an error: invalid reference \1 on `s' command's RHS.</p>
  
  <p>Whats wrong with the expression? Using GNU sed.</p>