title: removing duplicates using awk in unix
body: <p>My file is in the format</p>
  
  <pre><code>&gt;id1
  sequence1
  &gt;id2
  sequence2
  &gt;id1
  sequence3
  </code></pre>
  
  <p>the output i want is:</p>
  
  <pre><code>&gt;id1
  sequence1
  &gt;id2
  sequence2
  </code></pre>
  
  <p>i.e. I need to remove sequences and id both in pairs if id is repeat.</p>
  
  <p>I tried the following code, but it doesnt work.</p>
  
  <pre><code>awk '{
  if(NR%2 == 1)
  {
      fastaheader = $0; x[fasta_header] = x[fasta_header] + 1; 
  }
  else 
  {
      seq = $0; {if(x[fasta_header] &lt;= 1) {print fasta_header;print seq;}}
  }
  }' filename.txt
  </code></pre>