Quote:
Originally Posted by keysorsoze
Thanks for the fast reply jailbat. I always thought you needed to cat a file before you can grep, and I always associated the find command to searching for contents in a file. Thanks for the help.
|
If you find yourself using `cat' with only one argument you're
pretty much certainly abusing it. `cat' is short for conCATenate,
it's a tool that allows you to glue
several files output together.
`cat oneFile | some other command' is pretty much always unnecessary,
commonly a `some other command oneFile' will do, sometimes you may
need to use a `some other command < oneFile' ...
In fact, in the case of grep you're depriving yourself of a great
lot of greps options, pertaining to the use or suppression of the
files name, for example.
When you want to know which files under /etc have the word shmoe in
them, but don't want to necessarily see the line, what you do is
a
Code:
grep -rl shmoe /etc/*
which you couldn't if you cat'ed the content of the files.
Cheers,
Tink