[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep -R "include" *.c --- not working
From: |
Bob Proulx |
Subject: |
Re: grep -R "include" *.c --- not working |
Date: |
Fri, 1 Oct 2004 09:31:52 -0600 |
User-agent: |
Mutt/1.3.28i |
Stephane Chazelas wrote:
> Bob Proulx wrote:
> > Call me a purist but I still think finding files is best left to find.
> > find . -name '*.c' -print0 | xargs -r0 grep include
>
> Why not the shell:
>
> grep include ./**/*.c
Well, you answer that question in your own suggestion:
> (with zsh or ksh93).
>
> You may need zargs (zsh) or command -x (ksh93) if the command line
> might get too long.
I don't know anything about zargs but it would seem that with a large
recursive filename glob expansion that overflowing ARG_MAX is a more
likely possibility. Using find avoids that problem completely.
It also follows the unix philosophy of small modular programs. Having
learned that grep provides the --include option you have learned only
that grep provides the --include option. That won't help you with
awk, sed, chmod, ls, etc. But having learned to use find you can now
use it with other commands in a general way.
Bob