Anne Wilson wrote:

>Is there a way of using grep to search for a word in all directories except 
>those under /mnt ?
>
>Anne
>
>
>------------------------------------------------------------------------
>
>Want to buy your Pack or Services from MandrakeSoft? 
>Go to http://www.mandrakestore.com
>
Well you don't want to search /proc either....

The easy way is probably to use a list that you develop with ls and sed

ls -I 'mnt' -I 'proc' -R -1 -d / | grep '/?|(yoursearchstring)'

should generate the list of files matching your search with each match 
headed by its enclosing directories.  That is is you are looking for a 
match in the file name.

Now if you are looking for a match in the file contents, it is a little 
trickier,,,

grep -i -l --exclude 'mnt|proc' -e (yourpatternwithoutquotes) /

The -i is for ignore case and the -l lists only the file, not the 
matching lines within it.  The --exclude implies recursive (-r or -d 
recurse).

Civileme




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to