Hi Philip,

Your command, as given below, will cause the shell the to expand '*.h' to
include all the files matching '*.h' in the current directory. To prevent
the shell from expanding the pattern, and just send it to grep, enclose
the pattern in a pair of quotes, ie,

grep -r --include='*.h' sometext .

You could also escape the wildcard, ie,

grep -r --include=\*.h sometext .

Cheers,

TAA

-----------------------------------------------------
Tony Abou-Assaleh
Lecturer, Computer Science Department
Brock University, St. Catharines, ON, Canada, L2S 3A1
Office: MC J215
Tel:    +1(905)688-5550 ext. 5243
Fax:    +1(905)688-3255
Email:  [EMAIL PROTECTED]
WWW:    http://www.cosc.brocku.ca/~taa/
----------------------[THE END]----------------------

On Thu, 4 May 2006 [EMAIL PROTECTED] wrote:

> I am finding that if my directory and/or subdirectory names have spaces in
> them (I am running cynwin under Windows XP), then the following form of
> grep does not work:
>
> grep -r --include=*.h sometext .
>
> (there is a dot or period at the end there)
>
> If I am in the directory where I know the file/text is and enter the
> above, it still does not find it. However if I enter:
>
> grep sometext *.h
>
> it does find it.
>


  • grep problem? Philip . Joslin
    • Re: grep problem? Tony Abou-Assaleh

Reply via email to