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.
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;
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to