[clue-tech] recursive grep

Greg Knaddison Greg at GrowingVentureSolutions.com
Mon Oct 18 14:45:06 MDT 2010


And the version with find has finished?

Reading the man page for find it seems it handles links in a pretty
fancy way, though by default it just skips them:

-P     Never  follow  symbolic  links.  This is the default behaviour.
 When find examines or prints information a file, and the file is a
symbolic link, the information used shall be taken from the properties
of the symbolic link itself.

The man page for grep doesn't seem to mention how the recursive mode
treats links.

Greg

--
Greg Knaddison | 720-310-5623 | http://growingventuresolutions.com
Mastering Drupal | http://www.masteringdrupal.com




On Mon, Oct 18, 2010 at 2:35 PM, David L. Willson <DLWillson at thegeek.nu> wrote:
> It wouldn't be much of a race. 'grep' without 'find' never finishes. I think it's following upward symlinks.
>
> David L. Willson
> Trainer, Engineer, Enthusiast
> MCT MSCE Network+ A+ Linux+ LPIC-1 NovellCLA UbuntuCP
> tel://720.333.LANS
>
> ----- "Greg Knaddison" <Greg at GrowingVentureSolutions.com> wrote:
>
>> I believe that adding find into the mix can make the process slower
>> than grep, unless you are using find to exclude some files.
>>
>> It would be interesting to benchmark them.
>>
>> Greg
>>
>> --
>> Greg Knaddison | 720-310-5623 | http://growingventuresolutions.com
>> Mastering Drupal | http://www.masteringdrupal.com
>>
>>
>>
>>
>> On Mon, Oct 18, 2010 at 2:22 PM, Clayton Fast
>> <cfast at compassbilling.com> wrote:
>> > find . -exec grep -l text-i-want-find {} \;
>> >
>> >
>> > ________________________________________________________________
>> > Clayton Fast, CHBME
>> > President
>> > Compass Billing Service Corporation
>> > 7800 E Orchard Road, Suite 190
>> > Greenwood Village, CO 80111
>> >
>> > (303) 713-1300
>> > www.compassbilling.com
>> >
>> > ______________________________________________________________
>> > This e-mail, including attachments, is intended for the exclusive
>> use of
>> > the person or entity to which it is addressed and may contain
>> confidential
>> > or privileged information. If the reader of this e-mail is not the
>> intended
>> > recipient or his or her authorized agent, the reader is hereby
>> notified
>> > that any dissemination, distribution or copying of this e-mail is
>> > prohibited.
>> > If you think that you have received this e-mail in error, please
>> advise the
>> > sender by reply e-mail of the error and then delete this e-mail
>> > immediately.
>> > Thank you.
>> >
>> >
>> > ________________________________
>> > From: clue-tech-bounces at cluedenver.org
>> > [mailto:clue-tech-bounces at cluedenver.org] On Behalf Of David L.
>> Willson
>> > Sent: Monday, October 18, 2010 2:19 PM
>> > To: clue-tech
>> > Subject: [clue-tech] recursive grep
>> >
>> > Does anyone have a good idea for "find absolutely every file in
>> haystack/,
>> > that mentions needle"?
>> >
>> > "grep -R needle /etc/*" and "grep -R needle /var/*"seem to run
>> forever.
>> >
>> > I think it's a "find /etc -xtype f -exec grep ... something, but I
>> can't
>> > think of the right something.
>> >
>> > David L. Willson
>> > Trainer, Engineer, Enthusiast
>> > MCT MSCE Network+ A+ Linux+ LPIC-1 NovellCLA UbuntuCP
>> > tel://720.333.LANS
>> >
>> > --
>> > This message has been scanned for viruses and
>> > dangerous content by MailScanner, and is
>> > believed to be clean.
>> > --
>> > This message has been scanned for viruses and
>> > dangerous content by MailScanner, and is
>> > believed to be clean.
>> > _______________________________________________
>> > clue-tech mailing list
>> > clue-tech at cluedenver.org
>> > http://cluedenver.org/mailman/listinfo/clue-tech
>> >
>> _______________________________________________
>> clue-tech mailing list
>> clue-tech at cluedenver.org
>> http://cluedenver.org/mailman/listinfo/clue-tech
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://cluedenver.org/mailman/listinfo/clue-tech
>


More information about the clue-tech mailing list