grep -vf too slow with large files

后端 未结 1 439
生来不讨喜
生来不讨喜 2020-12-19 11:41

I am trying filter data from data.txt using patterns stored in a file filter.txt. Like below,

grep -v -f filter.txt data.txt > op.txt

Th

1条回答
  •  轮回少年
    2020-12-19 11:46

    Based on Inian's solution in the related post, this awk command should solve your issue:

    awk 'FNR==NR {hash[$0]; next} !($0 in hash)' filter.txt data.txt > op.txt
    

    0 讨论(0)
提交回复
热议问题