I have a very large plain text file (multiple gigabytes in size) which I need to search for certain strings. When using
grep, I get over 11,000 matches of a string but with
ag I get roughly 1,500. The output of the two commands is the same up to the point where
I am aware of the
-m option in
ag defining the maximum number of matches but this defaults to 10,000 and so is not the issue.
To illustrate this, here is an example of what's happening:
$ grep -i 'string' hugefile.txt | wc -l 11000 $ ag -i 'string' hugefile.txt | wc -l 1500
The output of the two commands is identical to the same number of matches:
$ grep -m 1500 -i 'string' hugefile.txt > grep_output.txt $ ag --no-numbers -i 'string' hugefile.txt > ag_output.txt $ diff grep_output.txt ag_output.txt (files identical)
ag have an implicit maximum input size and if so, is it possible to alter this?