ag Needle < haystack
No need for cat ag Needle < haystack
No need for catPipes 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/Redirecti...
grep needle haystack
Surely grep needle < haystack
is much closer to that form than cat haystack | grep needleWill work too, and now it's in the logical order.