Hacker News new | past | comments | ask | show | jobs | submit login

Isn't `some-command < somefile` more idiomatic (also, should spawn one process less)?



Yes. See "Useless use of cat" (or "UUOC").

If you prefer to have the command arguments at the end of the line (so it's easier to amend), you can do e.g:

  < file.txt grep pattern
instead of

  grep pattern file.txt
or

  cat file.txt | grep pattern

There are also some related useless uses, like useless use of grep | awk:

  grep pattern file | awk '{print $3}'
which can instead be written as

  awk '/pattern/ {print $3}' file




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: