for each line of the second file: parse it and locate the key store the second line in a hash indexed by its key endfor for each line of the first file: parse it and locate its common key with the second file look up the associated line using the hash do something with both lines endfor