title: Bash scripting. Hiding output of one particular command in a script thats output to a file
body: <p>This script of mine is slowly getting larger. It has its output piped to a file on invocation (which is later used to build an email body), however, I have one particular command that's invoked in that script whose output I want to trim down.</p>
  
  <p>I was trying to do</p>
  
  <pre><code>./somecommand | egrep "pattern1|pattern2"
  </code></pre>
  
  <p>Which works fine in a regular console window, however when snuck into my larger script, the pipe to egrep gets ignored and the whole output of the "./somecommand" lands in the output of the parent script.</p>
  
  <p>How can fix?</p>
  
  <p>I'm keeping this question vague to avoid copy pasting the whole damn thing. More info can be provided on request. And yes, scripts within scripts within scripts, we need to go deeper, etc. I'm up to five scripts so-far handling different tasks as part of a larger multi-server backup operation. The main operating script is output to a text file which an email body is built around, this serves as the logging that the end user sees. One particular script I'm calling from within the main script is quite 'noisy', hence the egrep to grab just the output relevant to the users.</p>
  
  <p>Thanks folks!</p>