Dear monks, After a long time, I seek your wisdom once again!

I have two big input files of about 1.5 million rows each (each rows actually consists of a unique ID number). Lets call them file#1 and file#2. The vast majority of these ID numbers occurs one time in BOTH these files and some ID number are exclusive to file#1 OR file#2 only.

What I want to do is to produce an output of three files: 1) one file with IDs occurring in both input files, 2) one file containing IDs unique to file#1 and 3) one file containing IDs unique to file#2.

I mean... I know how to write the code to do this kind of stuff, but its taking forever the way I wrote it. Its the first time I have to deal with huge files like this... Anyone have a suggestion for an efficient implementation for this kind of task?

In reply to Help for finding duplicates in huge files by julio_514

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.