In one file we have employee number and salary and in another file we have employee number and designation . Now in the output file i want to print salary and designation with corresponding employee number ?
Probably the fastest way to do that is to read all of file2 into an in-memory array(s). Then start reading file1 line by line. Read a line, search file2 array for employee ID, when found print to third file or to screen. Repeat that for each line in file1.
That might be optimized if both files are sorted by employee ID, such as you would not have to read file2 into memory first.
Exactly how to do that will depend on what programming language you will use.