title: How to use sed command to add a string before a pattern string?
body: <p>I want to use sed to modify my file named "baz".</p>
  
  <p>When i search a pattern foo , foo is not at the beginning or end of line, i want to append bar before foo, how can i do it using sed?</p>
  
  <pre><code>Input file named baz:
  blah_foo_blahblahblah
  blah_foo_blahblahblah
  blah_foo_blahblahblah
  blah_foo_blahblahblah
  
  Output file 
  blah_barfoo_blahblahblah
  blah_barfoo_blahblahblah
  blah_barfoo_blahblahblah
  blah_barfoo_blahblahblah
  </code></pre>