Wednesday, 7 August 2013

Python: Compare information in two text files and write matching info to new file

Python: Compare information in two text files and write matching info to
new file

Hope to have suggestions for solving this
I have two text files A and B
A=
23,34,67,56
45,66,86,98
65,113,77,99
B=
11,34,58,99,109,24
23,34,67,56,99,98
55,100,75,45,44,90
65,113,77,99,114,45
What I want is to select all row elements in B where there is a match
between a unique key value made from concatenating the first two row
elements, and write these lines to a new file C.
Based on the example files A and B;
C=
23,34,67,56,99,98
65,113,77,99,114,45
The input files both have typically 100 000 rows Thank you for assistance

No comments:

Post a Comment