<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Thanks for the info.&nbsp; I already adopted a program from another
person and it works like a charm.&nbsp;&nbsp; As for your question, I had no idea
of if I had duplicate or more as there was some 570 line items.&nbsp; I
whittled it down to 370 line entries.&nbsp; Whew. <br>
<br>
Ken<br>
</tt><br>
Luke Paireepinart wrote:
<blockquote
 cite="mid:dfeb4471003201402h62454c06n7c6c9922d73dd39b@mail.gmail.com"
 type="cite"><br>
  <br>
  <div class="gmail_quote">On Sat, Mar 20, 2010 at 11:34 AM, Ken G. <span
 dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:beachkid@insightbb.com">beachkid@insightbb.com</a>&gt;</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;">What
is a method I can use to find duplicated entry within a sorted numeric
file? &nbsp;<br>
I was trying to read a file reading two lines at once but apparently, I
can only read one line at a time. &nbsp;Can the same file be opened and read
two times within a program?<br>
    <br>
For example, a file has:<br>
    <br>
1<br>
2<br>
2<br>
3<br>
4<br>
4<br>
5<br>
6<br>
6<br>
    <br>
The newly revised file should be:<br>
    <br>
1<br>
2<br>
3<br>
4<br>
5<br>
6<br>
    <br>
Again, thanking the group for their input,<br>
    <font color="#888888"><br>
    </font></blockquote>
  <div><br>
One-liner:<br>
open("output.txt", "w").write("\n".join(sorted(set([i.strip() for i in
open("input.txt")]))))<br>
  <br>
  <br>
Just for fun :)<br>
  <br>
also, in your algorithm, why are you assuming there are at most 1 extra
entries in the case of a duplicate?&nbsp; Why not generalize it for all
duplicates?<br>
-Luke<br>
  </div>
  </div>
</blockquote>
<br>
</body>
</html>