title: Shell Script : How to use Tee command with sed command
body: <p>Before:</p>
  
  <pre><code>main 2&gt;&amp;1 | tee -a $log_file;
  </code></pre>
  
  <p>This is working fine but it is throwing stderr in $log_file as shown below. I want to replace:</p>
  
  <pre><code>"ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : (stderr)"
  </code></pre>
  
  <p>With:</p>
  
  <pre><code>"NOTE (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : (stderr)"
  </code></pre>
  
  <p>I want the version and date to be in regex format.</p>
  
  <p>After:</p>
  
  <pre><code>main 2&gt;&amp;1 | tee -a | sed -i 's|ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : (stderr)|NOTE (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : (stderr)|g' $log_file;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Rtluz.png" rel="nofollow">Error which are coming at downloading time</a></p>
  
  <p><a href="https://i.stack.imgur.com/h04wc.png" rel="nofollow">Few lines coming at the end(The lines are jumbled)</a></p>