3
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 ag
stops.
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)
Does ag
have an implicit maximum input size and if so, is it possible to alter this?
Same here. Except my file has only 1.5 GB. With Grep it is slower, but complete :/ – Mailo Světel – 2014-11-19T09:28:23.607