We have a rather large and complex file system, and I'm trying to create a list of files containing a specific text string. This should be simple, but I need to exclude the directories "./svn" and "./pdv" (and possibly others) and look only at files like * .p, * .w or .i.
I can easily do this with a program, but it works very slowly. I want to speed up the process (so I have searched thousands of files many times), since I need to run such searches on a long list of criteria.
Usually we look for a file system using:
find . -name "*.[!r]*" -exec grep -i -l "search for me" {} \;
This works, but I have to use the program to exclude unwanted directories, so it works very slowly.
After exploring the topics here: flow
I decided to try several other approbations:
grep -ilR "search for me" . --exclude ".svn" --excluse "pdv" --exclude "!.{p,w,i*}"
Excludes './svn', but not the './pdv' directory, does not limit the files viewed.
grep -ilR "search for me" . --exclude ".svn" --excluse "pdv" --include "*.p"
Excludes './svn', but not the './pdv' directory, does not limit the files viewed.
find . -name "*.[!r]*" -exec grep -i -l ".svn" | grep -i -l "search for me" {} \;
I can't even get this (or options on it) to work successfully.
find . ! -name "*.svn*" -prune -print -exec grep -i -l "search for me" {} \;
It does not return anything. It looks like it stops as soon as it finds the .svn directory.