@farhan it's more coherent and unixy that way
@farhan grep file -e pattern
@farhan it voted "grep string file", but it really depends on how I arrive at the pipeline.
If I already have a cat at the beginning, then add some grep in the middle, then remove stuff so the grep is now right after the cat, I'm unlikely to remove the cat.
However, when I start writing a pipeline, I never start it like "cat file |grep string", I do "grep string file" instead
grep string < file
@farhan There are uses for both. cat | grep when finding out what is the best pipeline for processing a file (usually, more than just grep comes after). grep directly when performance optimization is needed.
@farhan Hey, it's split at exactly 50-50
@farhan In interactive use, I often start my pipeline with a cat and iteratively build it up from there.
@farhan usually the latter, but if I was using cat in the last command, there's a high chance I'll do the former
@farhan For what it's worth, it took me like 2 months to get the hang of it.
@farhan honestly it's about 50/50. i grep pattern file more often when globbing or running a recursive grep, but for single files i tend to unthinkingly cat to grep
@farhan i love using pipes, but since i discovered the correct way to use grep, i'm using it that way
@farhan I am disgusting and use pipes much more than strictly necessary
@farhan nooooo I lost 😥😂
@Secstodon haha, me too
btw, did you get a notification when this ended?
@farhan I did
@Secstodon HAHAHA that's awesome :)
@farhan my weakness is the use of file | grep term...
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either! We adhere to an adapted version of the TootCat Code of Conduct and have documented a list of blocked instances. Ash is the admin and is supported by Fuzzface, Brian!, and Daniel Glus as moderators. Hosting costs are largely covered by our generous supporters on Patreon – thanks for all the help!