[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Filename pattern in grep --include=....
From: |
Bob Proulx |
Subject: |
Re: Filename pattern in grep --include=.... |
Date: |
Thu, 2 Feb 2006 23:18:09 -0700 |
User-agent: |
Mutt/1.5.9i |
Com MN PG P E B Consultant 3 wrote:
> What type of PATTERN can be used here (i.e. glob, regex, extended regex,
> etc.)?
As you heard this is the wrong list but...
> For example, I want to search recursively below a directory D, but want
> to check
> only files starting with "no" or "uh". How do I do this using --include
> ?
Using find for finding files is best. Really having grep do directory
processing is a misfeature.
> I tried the following:
>
> # glob pattern
> grep -r --include="{no,uh}*" abc D
If you want bash/csh style file globbing them you can just use bash
directly, for the current directory anyway.
echo {no,uh}* | xargs grep
> # extended regexp
> grep -r --include="(no|uh).*" abc D
For that plain old find is best.
find D -name 'no*' -o -name 'uh*' | xargs grep
> # Look at all files
> grep -r abc D
Try:
grep -r abc .
Bob