I think it can be optimized, and if programing language doesn't matter:<br>#!/usr/bin/python<br><br>file="test.txt"<br>fl = open(file,'r')<br>toParse = fl.readlines()<br>fl.close()<br>dublicates = []<br>
firstOne = []<br>for ln in toParse:<br>    ln=ln.strip()<br>    lnMap = ln.split(':')<br>    target = lnMap[2]<br>    if target in firstOne:<br>        if not target in dublicates:<br>            dublicates.append(target)<br>
    else:<br>        firstOne.append(target)<br>for ln in toParse:<br>    ln = ln.strip()<br>    lnMap = ln.split(':')<br>    target = lnMap[2]<br>    if target in dublicates:<br>        print ln<br><br><br><div class="gmail_quote">
On Wed, Oct 28, 2009 at 7:09 PM, Truejack <span dir="ltr"><<a href="mailto:truejack@gmail.com" target="_blank">truejack@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Need a scripting help to sort out a list and list all the duplicate lines.<br><br>My data looks somethings like this<br>

<br>host6:dev406mum.dd.mum.test.com:22:11:11:no<br>host7:dev258mum.dd.mum.test.com:36:17:19:no<br>host7:dev258mum.dd.mum.test.com:36:17:19:no<br>
host17:dev258mum.dd.mum.test.com:31:17:19:no<br>host12:dev258mum.dd.mum.test.com:41:17:19:no<br>host2:dev258mum.dd.mum.test.com:36:17:19:no<br>host4:dev258mum.dd.mum.test.com:41:17:19:no<br>host4:dev258mum.dd.mum.test.com:45:17:19:no<br>


host4:dev258mum.dd.mum.test.com:36:17:19:no<br><br>I need to sort this list and print all the lines where column 3 has a duplicate entry.<br><br>I need to print the whole line, if a duplicate entry exists in column 3.<br>


<br>I tried using a combination of "sort" and "uniq" but was not successful.<br><br>
<br>_______________________________________________<br>
CentOS mailing list<br>
<a href="mailto:CentOS@centos.org" target="_blank">CentOS@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br>
<br></blockquote></div><br>