Sorry for the lack of clarity in my question. I have a list of all the employee's names in one file and the other file has some names from some department. Input All employee file: John Smith Terry Smith Input Dept file: HR John Smith 6th floor R&D Terry Smith 5th floor I would like output to be if John Smith in Dept file exists in All employee file, print out his info. Hope that helps clear the question a bit. Thanks for your advice. Will definitely read the how not to ask question :)