Print lines in one file matching patterns in another file

后端 未结 5 966
-上瘾入骨i
-上瘾入骨i 2020-11-29 06:45

I have a file with more than 40.000 lines (file1) and I want to extract the lines matching patterns in file2 (about 6000 lines). I use grep like this, but it is very slow: <

5条回答
  •  孤街浪徒
    2020-11-29 07:32

    Try grep -Fwf file2 file1 > out

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

提交回复
热议问题