|There's more than one way to do things|
Diff CSV files - But ignore certain fieldsby tsk1979 (Scribe)
|on Mar 04, 2013 at 10:59 UTC||Need Help??|
tsk1979 has asked for the
wisdom of the Perl Monks concerning the following question:
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
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.