[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep problem?

From: Tony Abou-Assaleh
Subject: Re: grep problem?
Date: Tue, 9 May 2006 03:26:45 -0300 (ADT)

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 .



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:  address@hidden
WWW:    http://www.cosc.brocku.ca/~taa/
----------------------[THE END]----------------------

On Thu, 4 May 2006 address@hidden 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]