how to exlude certain directory from grep search path

From: H. S. (g_reate_xcalibur_at_yahoo.com)
Date: 08/30/05


Date: Tue, 30 Aug 2005 17:25:05 -0400


Hi,

I am trying to find all files that contain a certain string using grep
recursively:
$> grep -v -r --exclude=dirN/* --include=*.php -e pdf

So I am searching for "pdf" string in all *.php files recursively in the
current directory. However, there is a directory that I want to exclude
from the search path:
./dirbase/dirN

I do not want grep to look in "dirN" at all. How do I do that? The
command above doesn't work to exlude everthing under "dirN".

thanks,
->HS

-- 
(Remove all underscores,if any, from my email address to get the correct 
one. Apologies for the inconvenience but this is to reduce spam.)


Relevant Pages

  • Re: List files containing a string..
    ... Er, the question was about files containing a string, not about file ... got were responses like man grep, ... What is not readily apparent in the xargs man page is that it ... that is the standard one on FreeBSD has a -r/-R option and even ...
    (comp.unix.bsd.freebsd.misc)
  • Looking for text inside files does not work at all
    ... for an ascii text string in a file. ... Hex-editing the file reveals that there is a string called "reloc" right ... So if text search (aka grep) worked, this should work too shouldn't it? ... That's how it worked in Windows 2000. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: modifying files using script
    ... specific string with another one. ... This script works well for one file but exits after that. ... so I used fgrep in the example (grep -F may be preferable or required ... as string by fgrep and RE by $editor, ...
    (comp.unix.shell)
  • Looking for ascii text inside files doesnt work at all
    ... for an ascii text string in a file. ... Hex-editing the file reveals that there is a string called "reloc" right at the beginning of the file. ... So if text search (aka grep) worked, this should work too shouldn't it? ... I change the term in the _middle_ input field to 'i.cpl'. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: grep a string
    ... > I am trying a find all occurences of a SUBSTR in string ... > will -b option for grep be useful. ... SUBSTR or not. ... > perl script to find all occurences of SUBSTR.. ...
    (comp.unix.shell)