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

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

Re: Grep option request


From: Bob Proulx
Subject: Re: Grep option request
Date: Mon, 13 Nov 2000 13:05:35 -0700 (MST)

Juhana

> I had to search a large mailing list archive. "grep word */*.html"
> didn't work because there was too many files. I tried following:
>   for i in `find|grep html`; do grep Word $i; done
> It worked but now there are no filename prefixes!

The traditional method of doing what you want is to use find and
xargs.  Try the following:

  find . -name '*.html' -print | xargs grep Word /dev/null

Since /dev/null is always provided as one of the files there are
always multiple files present for grep.  In the case of multiple files
grep prints the filename.

I believe this should provide all of your requested functionality
within the traditional UNIX framework.

Bob



reply via email to

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