[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep : -r (recursive) option does not work when... ( grep (GNU gre
From: |
Paul Jarc |
Subject: |
Re: grep : -r (recursive) option does not work when... ( grep (GNU grep) 2.4 ) |
Date: |
Mon, 03 Sep 2001 18:35:45 -0400 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7 |
Andre Gompel <address@hidden> wrote:
> grep : -r (recursive) option does not work in the follwing context:
>
> grep -ri string *.c
That isn't supposed to do what you want. Try this instead:
find . -name '*.c' | xargs grep -i string
grep -r searches *all* files in the directories you give on the
command line. It doesn't let you search just the files whose names
match a shell pattern. You specified *.c. The shell expanded this to
all names matching this pattern before grep ever saw it.
> Error message: "No such file or directory".
Presumably, there were no such files in your working directory, so the
shell left "*.c" unmodified. So grep looked for a file or directory
called "*.c", but there was none.
paul