title: Case-insensitive search and replace with sed
body: <p>I'm trying to use SED to extract text from a log file. I can do a search-and-replace without too much trouble:</p>
  
  <pre><code>sed 's/foo/bar/' mylog.txt
  </code></pre>
  
  <p>However, I want to make the search case-insensitive. From what I've googled, it looks like appending <code>i</code> to the end of the command should work:</p>
  
  <pre><code>sed 's/foo/bar/i' mylog.txt
  </code></pre>
  
  <p>However, this gives me an error message:</p>
  
  <pre><code>sed: 1: "s/foo/bar/i": bad flag in substitute command: 'i'
  </code></pre>
  
  <p>What's going wrong here, and how do I fix it?</p>