▲ | Rygian 10 hours ago | |||||||
Learned two things: `unbuffer` exists, and “unnecessary” cats are just fine :-) | ||||||||
▲ | Dan42 43 minutes ago | parent | next [-] | |||||||
grep has a --line-buffered option that does the job fine in most cases. Just set in your aliases grep='grep --line-buffered', that way you get the correct behavior when you tail logs piped to a sequence of greps, and you avoid the performance penalty in scripts. | ||||||||
▲ | wrsh07 9 hours ago | parent | prev | next [-] | |||||||
I like unnecessary cat because it makes the rest of the pipe reusable across other commands Eg if I want to test out my greps on a static file and then switch to grepping based on a tail -f command | ||||||||
| ||||||||
▲ | samatman an hour ago | parent | prev [-] | |||||||
I prefer the trivial cat, because the < redirect puts the source in the middle of the pipe.
vs.
It looks more like what it is. Also, with cat you can add another file or use a glob, that's come in handy more than once.Furthermore, it means the first command isn't special, if I decide I want something else as the first command I just add it. Pure... concatenation. heh. It's useful to know both ways, I suppose. But "don't use trivial cat" is just one of those self-perpetuating doctrines, there's no actual reason not to do things that way if you want. |