This has always bugged me. If I want to do a recursive search on all files of a specific type (like *.c*, for instance)?
This works:
grep -R 2.04.0 * |grep VERSION
but it takes forever, because the directories rooted here contain large binary files, and many other files than the *.c files which take a long time to traverse.
This just doesn't work, but says (to me, anyway) exactly what I want to do: search all the *.c files rooted at the current directory for files with the word VERSION and a number that looks like 2.04x0 for any digit x.
grep -R 2.04.0 *.c | grep VERSION
It will find all the *.c files that meet the criterion in the current directory, but it doesn't recurse, in spite of the "-R" option.
I have tried every variation I can think of and just can't find the right combination.
This same issue of not being able to recurse on specific file types has always bugged me about Linux and Unix, not just for grep, but for ls as well.
It just seems to me that there must be something wrong either with the recursive parsing facility of Linux/Unix (or more likely my understanding of it!) :-)
Start Free Trial