Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I feel you.

I still `cat foo | grep bar` instead of `grep foo bar`



But to me -- this is different?

I believe "useless use of cat" is FAR MORE useful than what the ultra-nerds say; I could care less about "saving a few characters."

The mental model of the pipeline --in one end and out the other -- is entirely too usefully intuitive and way better than some imaginary geek-cred.

(I was more thinking about the new rust tools, e.g. rg instead of grep)


Plus sometimes you want to throw something like `pv` in.


Plus the regex is more likely incorrect in the first attempt and needs to be fixed.


The reason I stick to `cat foo | grep bar` is that I am never quite sure if `grep bar foo` would be correct instead (it is).


I remember it as "grep for a needle in a haystack"


The file argument is usually the last so that you can do eg `grep foo -- *`


Might help to replace

    cat foo | $command
with

    <foo $command
It's the same order, but I think $command can sniff what kind of file stdin is, and optimize.


The former has one big advantage: I can easily change "needle" without having to skip all over the cmdline...

Pretty usefull when debugging something interactively.


Actually instead of `grep bar foo`.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: