open 5k file foreach line get key from line and put it in hash as key=1 close 5k file open 100M file foreach line get key from line if key is in hash from other file do stuff with the line close 100M file