when i want to compare a files with +10,000,000 lines to other 2,000,000 lines (i had to cancel and close the script )
The comm-code above took 9 seconds to find all matches (and my PC is not very fast). I strongly suggest to use the proper tools for the job
Update: it used 1.5 GB RAM to do this. If you have much more data to compare, it might reduce memory load if you sort the files first.