title: Redirect a filtered by grep STDERR to a file
body: <p>This article <a href="http://burgerbum.com/stderr_pipe.html" rel="nofollow noreferrer">http://burgerbum.com/stderr_pipe.html</a> explains how to grep STDERR, and the filtered result is echoed on the screen.</p>
  <p>Example:
  The archiving program tar produces a lot of error messages on STDERR, some of which are important and some of which can be ignored. We'd like to see only the ones that show that there's really something wrong.</p>
  <pre><code>tar -cf /tmp/junk.tar /tmp/real /tmp/fake
  tar: Removing leading `/' from member names
  tar: /tmp/fake: Cannot stat: No such file or directory
  tar: Error exit delayed from previous errors
  </code></pre>
  <p>In order to remove <code>tar: Removing leading '/' from member names</code> and <code>tar: Error exit delayed from previous errors</code> from STDERR, but leave <code>tar: /tmp/fake: Cannot stat: No such file or directory</code>, author suggests the following:</p>
  <pre><code>(tar -cf /tmp/junk.tar /tmp/real /tmp/fake 3&gt;&amp;1 1&gt;&amp;2 2&gt;&amp;3 | egrep -v &quot;tar: Removing leading|tar: Error exit delayed from previous errors&quot;) 3&gt;&amp;1 1&gt;&amp;2 2&gt;&amp;3
  </code></pre>
  <p>The only STDERR output will be: <code>tar: /tmp/fake: Cannot stat: No such file or directory</code></p>
  <p><strong>Question</strong>: how to achieve same results, but instead for echoing =&gt; write to a file?</p>
  <p>I used tar example because it's native to the article.</p>
  <p>But my <strong>real case</strong> is <code>mysqldump</code>, which generates STDOUT (that I don't want to mess), and also generates STDERR - that I need to filter and write to a file.</p>
  <pre><code>mysqldump --user=db_username --password=db_password --add-drop-database --host=db_host db_name 2&gt;&gt; '/srv/www/data_appsrv/logs/mysql_date_ym.log' &gt; '/mnt/backup_srv/PFTLXTKDEV/backup/daily/file_nm_db'
  </code></pre>
  <p>I need to exclude <code>Warning: Using a password</code> string from STDERR that is written to <code>mysql_date_ym.log</code></p>
  <p>I tried variations with <code>2&gt;&gt;</code> and <code>&gt;</code>, but none works.</p>