How big are these files and how much memory do you have on your system? If the first file is sufficiently small then you can read it into a hash based on the matching string and then just check the hash for each entry in the second file. If this looks practical, I can help you with the code...