perlscript value file1 file2 > matched.lines # or grep value file1 file2 > matched.lines