-1

I need a tool which counts occurences of a certain string in a large (~ 2GB) text file. Whats a good and fast tool?

Thanks!

4

2 回答 2

2

Install Cygwin and do grep -o string file | wc -w:-)

于 2013-04-19T12:13:43.577 回答
0

Edit: Works only on text files and only when the string occur once on each line

A simple python script:

input_file  = open( source_path , encoding="utf8" , mode='r' )
for line in input_file:
    if line.find("###") >= 0:
         Counter=Counter+1

yet grep shuld do the work better.

于 2013-04-19T12:16:06.400 回答