title: Bash - pipe multiple grep and print output
body: <p>I am writing a shell script which will grep a document for certain words and then displaying the found words in colour output.</p>
  
  <pre><code>echo $(egrep -wi --color=always 'error|exception' $logFile)
  </code></pre>
  
  <p>now I want to combine this grep with another one to exclude a few results
  For this I want to pipe above command to a grep command to exclude certain patterns</p>
  
  <pre><code>grep -vi '&lt;status&gt;error&lt;/status&gt;'
  </code></pre>
  
  <p>For some reason this fails when I try to execute the command </p>
  
  <pre><code>echo $(egrep -wi --color=always 'error|exception' $logFile | $(grep -v '&lt;STATUS&gt;ERROR&lt;/STATUS&gt;') )
  </code></pre>
  
  <p>or even if I try </p>
  
  <pre><code>echo $(egrep -wi --color=always 'error|exception' $logFile | grep -v '&lt;STATUS&gt;ERROR&lt;/STATUS&gt;')
  </code></pre>
  
  <p>What am I doing wrong? Why is this failing?</p>