Processing Large Files in Python [ 1000 GB or More]

后端 未结 8 974
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 06:27

Lets say i have a text file of 1000 GB. I need to find how much times a phrase occurs in the text.

Is there any faster way to do this that the one i am using bellow

8条回答
  •  天涯浪人
    2020-12-15 07:18

    Have you looked at using parallel / grep?

    cat bigfile.txt | parallel --block 10M --pipe grep -o 'how\ fast\ it\ is' | wc -l
    

提交回复
热议问题