title: How to execute multiple bash commands from Python?
body: <p>I have a grep query:</p>
  
  <pre><code>grep  "8=ABC\.4\.[24].*\|10=[0-9]+" output.txt |grep "35=8"| cut -d "|" -f 12 &gt;redirect.txt
  </code></pre>
  
  <p>How do I execute the same from inside a python script? I know for a simple grep it works as follows:</p>
  
  <pre><code>sed_process = subprocess.Popen(['sed', sed_query,fopen], stdout=subprocess.PIPE) 
  grep_query = "8=ABC\.4\.[24].*\|10=[0-9]+"
  grep_process = subprocess.Popen(['grep', grep_query], stdin=sed_process.stdout, stdout=subprocess.PIPE)
  </code></pre>
  
  <p>I'm confused as to how to combine 2 grep commands and a <code>cut</code> command and redirect it to an output file?</p>