Open felixlyd opened 6 years ago
unlike grep, ag doesn't support searching multiple regexes at once anyway, so an equivalent of grep's -f option doesn't make much sense.
Instead, join the regexes to search with |
characters using a set of tr/sed/awk/perk/python commands of your choice, such as ag "$(tr '\n' '|' <patterns.txt | sed 's/|$//')" tosearch.txt
It ain't the prettiest, but at least there's only one ag
invocation.
If the file "test.txt" and "reg_file" are huge, I should use grep like "cat test.txt | grep -f reg_file".
But I cannot find a way to use ag like that in the mannual of ag. And obviously, it will takes lots of time if I use ag with a for-loop.
I think I am a careless user,so that I cannot find the correct parameter.Could you do me a favor?Thanks a lot.