RE: find

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



MHR wrote:
> On Fri, Oct 3, 2008 at 7:27 AM, Akemi Yagi <amyagi@xxxxxxxxx> wrote:
> > On Fri, Oct 3, 2008 at 7:24 AM, Akemi Yagi <amyagi@xxxxxxxxx> wrote:
> > > On Fri, Oct 3, 2008 at 6:54 AM, Bo Lynch
> > > <blynch@xxxxxxxxxxxxxxxxx> wrote: 
> > > > 
> > > > I would recommend taking a look at grep. THere are many ways
> > > > you can use it. 
> > > 
> > > One such example is:
> > > 
> > > find . -type f -exec grep -il !* {} \;  -exec grep -i !* {} \;
> > > -exec echo \; 
> > > 
> > > alias it to, say, findword and run:  findword <text>
> > 
> > Sorry, I missed the "!" in the above paste:
> > 
> > find . -type f -exec grep -il \!* {} \;  -exec grep -i \!* {} \;
> > -exec echo \; 
> 
> I tend to do this:
> 
> find . -type f -exec grep <pattern> /dev/null {} \;
> 
> The "/dev/null" is because grep doesn't show the file name unless
> there are at least two provided, and this accomplishes what Akemi's
> command above does but in a single command.  Of course, it still takes
> forever if the directory whence the search begins is /.

Or you can do it like this:

find . -type f -exec grep -H <pattern> {} \;

>From the man page:
       -H, --with-filename
              Print the filename for each match.

-- 
Bowie
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux