3 ms·
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: < f
by aepiepaey 9y ago
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