Skip grep, use awk
ripgrep[1] is functionally incredibly similar to grep and ag, but is significantly faster[2] and supports a wider range of character encodings. In its short lifetime it has already become the default search tool for VSCode.I've switched to using it as my daily driver for text search and am incredibly happy with it.[1]: https://github.com/BurntSushi/ripgrep[2]: http://blog.burntsushi.net/ripgrep/Edit: I confused awk with ag originally leading to this comment. Using ripgrep as a pre-filter to awk is still a ridiculous amount faster, especially on large trees, so while the OP's suggestion is cool I can't see myself reaching for it often.