Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 2010 22:22:57 +0200
From:      Dimitry Andric <dimitry@andric.com>
To:        David Xu <davidxu@freebsd.org>
Cc:        delphij@freebsd.org, Gabor Kovesdan <gabor@freebsd.org>, current@freebsd.org
Subject:   Re: Official request: Please make GNU grep the default
Message-ID:  <4C6D92A1.8030109@andric.com>
In-Reply-To: <4C6D5EF2.2040603@freebsd.org>
References:  <4C6505A4.9060203@FreeBSD.org> <20100814155346.GA6510@nagual.pp.ru>	<4C66C0A4.3000301@FreeBSD.org> <4C6D5EF2.2040603@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090409070507040103030506
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 2010-08-19 18:42, David Xu wrote:
> When will the grep -H print file name for me ?  it is rather painful 
> that the feature is missing. :-(
> So I can not use it with find:
> 
> find . -exec grep -H {} world \;
> I don't know which file contains the word world.

I think you mean:

  find . -exec grep -H world {} \;

instead?  In any case, the fix is trivial, please try the attachment.

--------------090409070507040103030506
Content-Type: text/plain;
 name="bsdgrep-fix-H.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="bsdgrep-fix-H.diff"

diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 3cb277c..cc710ef 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -682,8 +682,6 @@ main(int argc, char *argv[])
 	if (dirbehave == DIR_RECURSE)
 		c = grep_tree(aargv);
 	else {
-		if (aargc == 1)
-			hflag = true;
 		for (c = 0; aargc--; ++aargv) {
 			if ((finclude || fexclude) && !file_matching(*aargv))
 				continue;

--------------090409070507040103030506--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C6D92A1.8030109>