4 ms·
At the very least ag does not handle large files. It bails with an error after the file gets too big.
by andrewprock 8y ago
At the very least ag does not handle large files. It bails with an error after the file gets too big.
- shakna 8y agoIt can crash, on large files, particularly on macOS because mmap is disabled by default. But that should go away by streaming the file. e.g. cat haystack | ag 'Needle'
- sebcat 8y agoag Needle < haystack No need for cat
- torstenvl 8y agoYour version requires fewer keystrokes. It's also mental model-breaking and un-Unixy. Pipes, my good man! Pipe everything to everything!
- muxator 8y agoHow come knowing how to redirect stdin is un-Unixy? Pipes are a good tool, and so are many others. Having a good command of other basic mechanisms of the shell is going to hugely pay off, try to have a brief shot if you want [0]. [0] https://www.gnu.org/software/bash/manual/html_node/Redirections.html https://www.gnu.org/software/bash/manual/html_node/Redirecti...
- twic 8y agoNo. Useless Use of Cat is sufficiently unidiomatic that there is an award for it: http://porkmail.org/era/unix/award.html http://porkmail.org/era/unix/award.html
- torstenvl 8y agoNo. Being smug doesn't make someone right. Especially when the smug person is advocating a special case. Special cases are inherently wrong, even when they "save" a process.
- xorcist 8y agoIf the most logical syntax is grep needle haystack Surely grep needle < haystack is much closer to that form than cat haystack | grep needle
- rleigh 8y agoMm, input redirection with the shell is the very epitomy of basic Unix functionality.
- BenjiWiebe 8y ago< haystack ag Needle Will work too, and now it's in the logical order.