title: Printing unique elements in lines in a separate .txt file
body: <p>I have a huge input file i.e,</p>
  
  <pre><code>con1    P1  140 602
  con1    P2  140 602
  con2    P5  642 732
  con3    P8  17  348
  con3    P9  17  348
  </code></pre>
  
  <p>I want to iterate inside each con, remove repetitive elements in line[2] and line[3] and print the result in a new .txt file so that my output file looks like this,(Note: my second column might be different for each con)</p>
  
  <pre><code>con1    P1  140 602
  con2    P5  642 732
  con3    P8  17  348
  </code></pre>
  
  <p>My attempted script(not sure how to finish)</p>
  
  <pre><code>from collections import defaultdict
  start = defaultdict(int)
  end = defaultdict(int)
  o1=open('result1.txt','w')
  o2=open('result2.txt','w')
  with open('example.txt') as f:
      for line in f:
          line = line.split()
          start[line[2]]
          end[line[3]]
          if start.keys() == 1 and end.keys() ==1:
              o1.writelines(line)
          else:
              o2.write(line)
  </code></pre>
  
  <p>UPDATE: Additional example</p>
  
  <pre><code>con20   EMT20540    951 1580
  con20   EMT14935    975 1655
  con20   EMT24081    975 1655
  con20   EMT19916    975 1652
  con20   EMT23831    975 1655
  con20   EMT19915    975 1652
  con20   EMT09010    975 1649
  con20   EMT29525    975 1655
  con20   EMT19914    975 1652
  con20   EMT19913    975 1652
  con20   EMT23832    975 1652
  con20   EMT09009    975 1637
  con20   EMT16812    975 1649
  </code></pre>
  
  <p>Expected output,</p>
  
  <pre><code>con20   EMT20540    951 1580
  con20   EMT14935    975 1655
  con20   EMT19916    975 1652
  con20   EMT09010    975 1649
  con20   EMT09009    975 1637
  </code></pre>