title: Replacing first occurance of a match with sed
body: <p>I am doing a find and replace with sed, replacing the BASH variable <code>$a</code> (when at the start of a new line) with the BASH variable <code>$b</code>:</p>
  
  <pre><code>sed -i "s#^$a#$b#" ./file.txt
  </code></pre>
  
  <p>This replaces all matches for <code>^$a</code>. How can I replace only the first occurrence of <code>^a</code> within the entire file?</p>