title: Executing awk command from python
body: <p>I am trying to execute the following <code>awk</code> command from a python script</p>
  
  <pre><code>awk 'BEGIN {FS="\t"}; {print $1"\t"$2}' file_a &gt; file_b
  </code></pre>
  
  <p>For this, I tried to use <code>subprocess</code> as follows:</p>
  
  <pre><code>subprocess.check_output(["awk", 'BEGIN {FS="\t"}; {print $1"\t"$2}',
                           file_a, "&gt;",
                           file_b])
  </code></pre>
  
  <p>where <code>file_a</code> and <code>file_b</code> are strings pointing to the path of the files.</p>
  
  <p>From this, I am getting the error </p>
  
  <blockquote>
    <p>awk: cannot open > (No such file or directory)</p>
  </blockquote>
  
  <p>I'm sure I'm inputing the arguments to <code>subprocess</code> in a wrong way, but I can't figure out what's wrong.</p>