Follow

Which do you do? Be honest.

Please boost :)

I'll be honest, 99% of the time I run cat file | grep string

@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

@farhan
Pathetic

:drake_dislike: everything above
:drake_like: 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 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

@Secstodon haha, me too

btw, did you get a notification when this ended?

Sign in to participate in the conversation
Mastodon for Tech Folks

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!