Re: find in conjuction with grep
From: Kevin Wang (rightsock_at_gmail.com)
Date: 08/12/04
- Previous message: Bill Tetens: "Re: Cannot install FC2"
- In reply to: Alexander Dalloz: "Re: find in conjuction with grep"
- Next in thread: Cameron Simpson: "Re: find in conjuction with grep"
- Reply: Cameron Simpson: "Re: find in conjuction with grep"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 12 Aug 2004 14:51:42 -0700 To: For users of Fedora Core releases <fedora-list@redhat.com>
two issues - security and performance. performance was covered
already. explicitly, xargs can be 100x or more faster.
The security issue I don't remember being explicitly covered.
find . -exec grep "string" {}
what happens when you have a filename with a space in it?
quotes?
double quotes?
xargs suffers from the same issues, that's why there's the -print0 arg
for find and -0 arg for xargs - \0 terminated strings are guaranteed,
as nulls are one of the only invalid filename characters.
sure, 99% of the time it isn't a problem, but when you're writing
scripts that run as root that are running on a multi user system
(think thousands of college students with too much time on their hands
just wanting to break in and read everyone else's email)
- Kevin
On Thu, 12 Aug 2004 22:10:37 +0200, Alexander Dalloz
<alexander.dalloz@uni-bielefeld.de> wrote:
> Am Do, den 12.08.2004 schrieb Lew Bloch um 21:08:
>
> > >>I've been using
> > >>> find . -exec grep "phrase I want" {} \;
> > >
> > > Not the best way. Using -exec is problematic.
> >
> > How exactly is the -exec directive problematic?
> >
> > I use "find ... -exec grep ..." a lot. I also use the "find ... | xargs
> > grep ..." a lot.
>
> Please see the thread discussion. It is already answered.
>
> 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 22:09:55 up 8 days, 15:37, load average: 1.27, 1.23, 1.27
>
>
>
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
- Previous message: Bill Tetens: "Re: Cannot install FC2"
- In reply to: Alexander Dalloz: "Re: find in conjuction with grep"
- Next in thread: Cameron Simpson: "Re: find in conjuction with grep"
- Reply: Cameron Simpson: "Re: find in conjuction with grep"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|