My friend is having two text files a and b. a is having 400 lines and b is having 50000 lines. He needs to compare the files and write in to a new log file where the matched contents should be written.
My friend's boss thinks that fetching 'a' line by line and comparing it with the file b at a stretch is effecient. But what my friend suggested is to open the file 'b' line by line and compare it with a regular expression framed by joining all the lines of a with '|'. My friend asked me which one is better and efficient. I thought that what my friend suggested is efficient.
Monks, please suggest us which method we should go for. Is there any other effecient way to do this?
Million thanks in advance.
use perl for(;;);