title: How to append lines to a new file with AWK
body: <p>I am trying to append lines to some new files with awk in this way:</p>
  
  <pre><code>#!/usr/bin/awk -f
  
  BEGIN { 
      FS = "[ \t|]"; }
  { 
      print $5 "\t" $13 "\t" $14 &gt;&gt; "./bed/" $5 ".bed";
  }
  END { 
  }
  </code></pre>
  
  <p>New file is created with filename derived from a field of awk input file (5th field). I am unable to execute this script since it fails with</p>
  
  <pre><code>awk: ./blast2bed.awk:6: (FILENAME=blastout000 FNR=1) fatal: can't redirect to `./bed/AY517392.1.bed' (No such file or directory)
  </code></pre>
  
  <p>Any hints?</p>
  
  <p>Thanks</p>