[SLUG] Pah, that Allsopp

Ross Kendall ross at rosskendall.com
Tue Nov 13 16:57:26 GMT 2007


Hi John,

My understanding is that while the 'grep -r' might be recursive, the
simple pattern match for the filename isn't (*php*).
grep -ir "models" *php*
...does a (case insensitive) recursive grep ("models") on any file or
directory in the current dir that matches *php*
So I guess your subdir doesn't match the string *php*

I would use find and grep together to do what you want:
find ./ -name *php* -type f -exec grep -i "models" '{}' \;

Hope that helps.

Cheers,
Ross.

John Allsopp wrote:
> .. only talks to us when he wants something.
>
> My family used to say that about my uncle who only came around when he
> wanted to borrow a ladder.
>
> Why doesn't
> grep -ir "models" *php*
>
> find matches in subdirectories on my machine, when if I navigate to a
> subdirectory the same command finds stuff? Using Fedora something or
> other.
>
> grep -ilr "models" *php*  ..  does that show the files or the files
> and their relative path?
>
> Hope everyone's well.
>
> Cheers
> J
>




More information about the Scarborough mailing list