find in conjuction with grep

Alexander Dalloz alexander.dalloz at uni-bielefeld.de
Wed Aug 11 19:49:29 UTC 2004


Am Mi, den 11.08.2004 schrieb Aaron Gaudio um 21:23:

> > >> I've been using
> > >> find . -exec grep "phrase I want" {} \;
> > >
> > > Not the best way. Using -exec is problematic.
> > 
> > why problematic? 
> 
> I think the main complaint is that it is slower, having to exec a new
> grep process for each file find encounters, versus piping to xargs
> (which will be faster overall, but provide less running feedback).

It is not only and mainly problematic because of speed, but because of
using resources and in worst case causing the system to be unresponsive.
This is as you correctly said, because for each find match it starts a
new child process. Do you always know how much matches are to be
expected by the find command? At worst it is as effective as a classic
fork bomb.

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 2 (Tettnang) kernel 2.6.7-1.494.2.2smp 
Serendipity 21:46:33 up 7 days, 15:14, load average: 3.45, 2.66, 2.32 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20040811/b89c2877/attachment-0001.sig>


More information about the fedora-list mailing list