title: Change value in config file that contains ' with sed
body: <p>I want to replace a value in my postgresql.conf with sed, this is the relevant part:</p>
  
  <pre><code>#archive_mode = off
  #archive_command = 'blah'
  </code></pre>
  
  <p>For setting archive_mode to on I use the following sed command and that works fine:</p>
  
  <pre><code>sed -ri "s/#(archive_mode) .*$/\1 = on/" postgresql.conf
  </code></pre>
  
  <p>Now I also want to change the <code>archive_command</code> to <code>'bleh'</code>. I tried the following command but sed always complains about the <code>'</code> character: <code>sed: -e expression #1, char 41: unknown option to s'</code></p>
  
  <pre><code>sed -ri "s/#(archive_command) .*$/\1 = 'bleh'/" postgresql.conf
  </code></pre>
  
  <p>I tried escaping the <code>'</code> with <code>\'</code> but that didn't help, does anybody know how I can get sed to include a ' in my replacement string?</p>