grep -f alternative for huge files

前端 未结 4 1765
慢半拍i
慢半拍i 2021-02-04 09:41
grep -F -f file1  file2

file1 is 90 Mb (2.5 million lines, one word per line)

file2 is 45 Gb

That command doesn\'t actually produce a

4条回答
  •  一生所求
    2021-02-04 10:16

    Try using LC_ALL=C . It turns the searching pattern from UTF-8 to ASCII which speeds up by 140 time the original speed. I have a 26G file which would take me around 12 hours to do down to a couple of minutes. Source: Grepping a huge file (80GB) any way to speed it up?

    So what I do is:

    LC_ALL=C fgrep "pattern" output
    

提交回复
热议问题