I have a script which runs over a data generated, and then creates a csv file Now I need to diff multiple csv files. But the diff as a twist Lets take a look at my sample csv file
Index1,Index_ID,Final_result,Method1,TimeGiven,TimeTaken,Result,Method +2,TimeGiven,TimeTaken,Result set1,541,PASSED,SOLVE12,13020,13481,UNDETERMINISTIC,Solve2,329614,683, +PASSED set1,542,FAIL,SOLVE12,13020,13531,UNDETERMINISTIC,Solve2,315259,84094, +FAIL set1,545,UNDETERMINISTIC,SOLVE12,13638,13403,UNDETERMINISTIC,Solve2,43 +6268,437526,UNDETERMINISTIC set1,546,UNDETERMINISTIC,SOLVE12,13638,13420,UNDETERMINISTIC + set1,547,UNDETERMINISTIC,SOLVE12,13638,13476,UNDETERMINISTIC + set1,548,UNDETERMINISTIC,SOLVE12,13638,13476,UNDETERMINISTIC + set1,549,UNDETERMINISTIC,SOLVE12,13638,13486,UNDETERMINISTIC + set1,550,UNDETERMINISTIC,SOLVE12,13638,13530,UNDETERMINISTIC + set1,551,UNDETERMINISTIC,SOLVE12,13638,13461,UNDETERMINISTIC + set1,552,UNDETERMINISTIC,SOLVE12,13638,13449,UNDETERMINISTIC
The first two fields constitude the index. So if I am comparing 2 csv files, I will compare based on this index. eg set1.551
To my script I will give more than 1 generated csv files
I want to print all those lines in a new CSV where
1. Index is not present in all the csv files
2. Either Field 3, field 7, and field 12(corresponding to columns) is different
Any fast and easy way to do this.

I have tried some hash based methods, but once I go to more than 2 files, things get complicated.
Here is what I am kind of trying
1. Read all csv files, create a hash of index<nr> 2. Store all indexes in an array which are not present in all the csv files
3. Store all indexes in an array where the number of columns for that particular row are different
3. For each index, extract the required fields, and then see if they are same in all the csv files
As you can see, its getting fairly complicated and I am getting confused, any help on how to proceed.

In reply to Diff CSV files - But ignore certain fields by tsk1979

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.