title: converting nexus to FASTA format
body: <p>I have many <code>.nexus</code> files that I want to convert to FASTA style format and combine into one <code>.fasta</code> file. Here is an example code:</p>
  
  <pre><code>for i in *.nexus;
  
  do
   awk 'NR &gt;5' /path/to/nexus_files/$i | tr -d "'" | tr " " "\n" | sed 's/locus/&gt;locus/g' &gt; /path/to/fasta/${i}.fasta
  done
  </code></pre>
  
  <p>This works for the first nexus file, but the <code>#NEXUS</code> header remains in subsequent conversions. </p>
  
  <h3>Input:</h3>
  
  <pre><code>#NEXUS
  begin data;
      dimensions ntax=1 nchar=300;
      format datatype=dna missing=? gap=-;
  matrix
  'locus1_individual-1' 
   ???????????????????????????????TAGATTTTTTAGTCCTTAC
  ;
  end;
  </code></pre>
  
  <h3>Desired output:</h3>
  
  <pre><code>&gt;locus1_individual-1
  ???????????????????????????????TAGATTTTTTAGTCCTTAC
  </code></pre>