bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep -R "include" *.c --- not working


From: Stepan Kasal
Subject: Re: grep -R "include" *.c --- not working
Date: Mon, 4 Oct 2004 12:32:26 +0200
User-agent: Mutt/1.4.1i

Hello,

> > find . -name '*.c' -print0 | xargs -r0 grep include /dev/null
> > 
> > This ensures that grep always preceeds the match with a filename, even if 
> > there's only one file found.

since you already use two GNU-specific features (-r and -0 in xargs), you
could as well adopt another one:

    find . -name '*.c' -print0 | xargs -r0 grep -H include
or
    find . -name '*.c' -print0 | xargs -r0 grep --with-filename include

The solution with /dev/null is a kludge.

(OTOH, I admit that it was unfortunate to advice ``grep -r --include''
because the user learns more from the find pipeline.)

Stepan Kasal




reply via email to

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