rschuler has asked for the wisdom of the Perl Monks concerning the following question:
I need to compare two files. These files have a key and a value on each line. I need to note when a key is in one file, and not in the other. I also need to note when the keys match, but the values are different. ex. given:
I need 2 absent from right-file, 3 absent from left-file and 4 is different. diff works so long as difference are separated by one or mores lines with a matching key and value. With the above input files diff produces:left-file right-file 1,a 1,a 2,b 3,c 4,f 4,g 5,h 5,h
Which is not quite right. -Bass has the beginnings of the shell of what I need. Being lazy, I was hoping the CPAN would have the algorithm I need, but I have found nothing. Note that the files are big, 1/2 million lines or so and the key and value are actually multiple fields.< 2,b < 4,f --- > 3,c > 4,g
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File comparison: not diff
by thelenm (Vicar) on Apr 09, 2002 at 16:30 UTC | |
by rschuler (Beadle) on Apr 09, 2002 at 20:23 UTC | |
Re: File comparison: not diff
by graff (Chancellor) on Apr 20, 2002 at 05:47 UTC |
Back to
Seekers of Perl Wisdom