You could put the data in a database, adding a linenum and a filenum field if necessary. Then, all you'd have to do is:

- foreach line $linenum - Compare the number of records returned by "SELECT * WHERE LINENUM=$linenum" to the number of records returned by "SELECT DISTINCT * WHERE LINENUM=$linenum". If they're different, there are duplicate records. - end

The same approach can be taken without a database. It involves regrouping all the files so that line1.dat contains the first line of every original file, line2.dat contains the second line of every original file, etc. Pseudo-code:

- foreach original file - $linenum = 1; - while not eof - append the line to file "line${linenum}.dat" - $linenum++; - end - end - foreach line file - Compare num of lines returned by 'cat line###.dat | sort | uniq' with the number of lines in line###.dat. If they're different, there are duplicate records. - end

A completely different approach is to convert your CSV files to fixed-length field files. Then you can easily compare an arbitrary line in one file to the same line in another file by using seek().


In reply to Re: Verifying data in large number of textfiles by ikegami
in thread Verifying data in large number of textfiles by dchandler

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.