Print lines in one file matching patterns in another file

Try grep -Fwf file2 file1 > out

The -F option specifies plain string matching, so should be faster without having to engage the regex engine.

Leave a Comment