title: How can I redirect STDERR to STDOUT, but ignore the original STDOUT?
body: <p>I have a program whose <code>STDERR</code> output I want to inspect and run <code>grep</code> on etc.</p>
  
  <p>So I could redirect it to <code>STDOUT</code> and use grep, but the problem is, I do <em>not</em> want the original <code>STDOUT</code> content.</p>
  
  <p>So, this one won't do</p>
  
  <pre><code>cmd 2&gt;&amp;1 | grep pattern
  </code></pre>
  
  <p>because it will mix the original STDOUT and STDERR.</p>
  
  <p>And this one doesn't work since grep doesn't read the STDERR output:</p>
  
  <pre><code>cmd 1&gt;/dev/null | grep pattern
  </code></pre>
  
  <p>But also, this one won't work:</p>
  
  <pre><code>cmd 1&gt;/dev/null 2&gt;&amp;1 | grep pattern
  </code></pre>
  
  <p>because the output will be completely empty, since everything gets written to <code>/dev/null</code>.</p>
  
  <p>But there must be a simple way to do it?</p>