If you find that 'diff' style solutions are choking on the sheer size of the file, and you can get away with sorting, I suggest doing that. You may be able to tweak something like gnu diff to work, or some perl diff solution, eventually, but I haven't had good luck doing similar things.

A decent 'sort' command should work reasonably quickly, but you may need to send the temporary files to another directory (gnutar has '-T' for this). I've sorted a file over a GB in size with over 6 million lines in less than an hour on a reasonable AIX box (probably more like half an hour) to do something similar. It shouldn't be hard to write something similar to comm.

FWIW, if you really must maintain ordering I'd suggest rewriting the file with line numbers appended to each line, and then using sort and ignoring line numbers during the 'comm' phase. You can reconstruct the original line ordering from the appended line numbers.

Update: s/conn/comm/

bluto


In reply to Re: Comparing Large Files by bluto
in thread Comparing Large Files by Anonymous Monk

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.