I suppose it is better to put your found columns in some sort of a db like mysql.
It is easier, especially if your columns have not the same size.
A B C
A B C
A B
B
if you put your found columns in db, you can run through your original files,
and at the end do a single select.