title: sed (or awk) regular expression to replace substring of match
body: <p>I have a text file ("file.txt") with the following contents:</p>
  
  <pre><code>#   disutil_screening = 0.00000; # favorable
      disutil_screening = 0.00009; # base
  #   disutil_screening = 0.00019; # unfavorable
  </code></pre>
  
  <p>I need to toggle which of these 3 lines (either the "favorable", "base", or "unfavorable") is commented-out using GNU Sed.</p>
  
  <p>I know that I can match the "favorable" line with code such as the following (where, as a dummy example, I simply replace text with "aaa"):</p>
  
  <pre><code>$ cat file.txt | sed -r 's/#[\t]disutil_screening[\ =0-9\.;]+# favorable/aaa/'
  aaa
      disutil_screening = 0.00009; # base
  #   disutil_screening = 0.00019; # unfavorable
  </code></pre>
  
  <p>However, this example Sed statement is obviously far from what I actually want.  I need a Sed expression that will merely remove the leading "#".   That is, I need a Sed expression (<code>$EXPR</code>) such that the contents of "file.txt" as shown above are modified in the following way:</p>
  
  <pre><code>$ cat file.txt | sed -r $EXPR
      disutil_screening = 0.00000; # favorable
      disutil_screening = 0.00009; # base
  #   disutil_screening = 0.00019; # unfavorable
  </code></pre>
  
  <p>Once I know how to do this (replace the leading "#" with "" for the "favorable" line), then I believe I can figure out how to add a "#" to the "base" line (i.e. comment out lines that are currently not commented-out).</p>
  
  <p><strong>Note</strong>: I'm open to using awk for this task instead of sed, but I'm a little intimidated by awk, never having used it before. </p>