[vox-tech] trouble running recursive grep

ME vox-tech@lists.lugod.org
Sun, 10 Mar 2002 10:47:51 -0800 (PST)


On Sun, 10 Mar 2002, eric nelson wrote:
> Why doesn't this work:
> 
> (as root)
> cd /usr/src/linux/include
> grep -r pci_dev *.h
> 
> 
> I get the error
> grep: *.h No such file or directory

Look in that directory, and you will likely see no .h files in that
diretory. This is where the error is reported. No match to *.h in that
dir and no dir to search recursively has a .h extention. :-)

Instead try:
# grep pci_dev */*/*.h
or
# grep pci_dev */*.h
And see if you get no error.

Then try 
# grep pci_dev *.h
and you should see the error again

An alternate?
find . -name \*.h -print0 | xargs -0 grep "pci_dev"

> In general, what is the best way to search system include files for specific 
> strings?

"best" is a subjective term. I bet everyone here has their own best, and
some probably have other ways to do the above.

-ME

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/CM$/IT$/LS$/S/O$ !d--(++) !s !a+++(-----) C++$(++++) U++++$(+$) P+$>+++ 
L+++$(++) E W+++$(+) N+ o K w+$>++>+++ O-@ M+$ V-$>- !PS !PE Y+ !PGP
t@-(++) 5+@ X@ R- tv- b++ DI+++ D+ G--@ e+>++>++++ h(++)>+ r*>? z?
------END GEEK CODE BLOCK------
decode: http://www.ebb.org/ungeek/ about: http://www.geekcode.com/geek.html