Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Oct 1999 02:55:04 +0900
From:      Tetsuro Teddy FURUYA (=?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=) <ht5t-fry@asahi-net.or.jp>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Search a symbol in the source tree
Message-ID:  <19991020025504I.tfuruya@galois.tf.or.jp>
In-Reply-To: Your message of "Mon, 18 Oct 1999 00:39:44 %2B0900" <19991018003944T.tfuruya@galois.tf.or.jp>
References:  <19991018003944T.tfuruya@galois.tf.or.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
Probably, my mail did not reach freebsd-hackers mailing list
because of absense of inreply-to headers.
So, I will resend.
------------------------------------------------------------
Return-Path: POPmail
Delivery-Agent: @(#)$Id: local.c,v 1.54 1998/10/30 06:30:53 akira1 Exp $ on canberra
Received: by j.asahi-net.or.jp (ATSON-1) ; 20 Oct 1999 01:14:43 +0900
Return-Path: <tfuruya@ppp142140.asahi-net.or.jp>
Received: from ppp142140.asahi-net.or.jp (ppp142140.asahi-net.or.jp [202.213.142.140])
	by tiga.asahi-net.or.jp (8.8.8/3.7W) with ESMTP id BAA22992
	for <ht5t-fry@asahi-net.or.jp>; Wed, 20 Oct 1999 01:11:18 +0900 (JST)
Received: from dilemma (tf051005.tf.or.jp [192.168.51.5])
	by galois.tf.or.jp (8.9.3/3.7W-Teddy-99050304) with SMTP id AAA28922;
	Wed, 20 Oct 1999 00:18:03 +0900 (JST)
Message-ID: <000201bf1a45$7952d340$0533a8c0@dilemma.tf.or.jp>
From: "Teddy" <tfuruya@ppp142140.asahi-net.or.jp>
To: "Brian Beattie" <beattie@aracnet.com>
Cc: n@nectar.com,
 zzhang@cs.binghamton.edu,
 freebsd-hackers@freebsd.org,
 nectar@nectar.com
Subject: RE: Search a symbol in the source tree 
Date: Wed, 20 Oct 1999 00:13:58 +0900
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by tiga.asahi-net.or.jp id BAA22992

Thank you for your mail !
At last, the final resolution has arrived !
Your answer is very very elegant and splendid !

-----Original Message-----
From : Brian Beattie <beattie@aracnet.com>
Sender : Tetsuro Teddy FURUYA <ht5t-fry@asahi-net.or.jp>
CC : n@nectar.com <n@nectar.com>; zzhang@cs.binghamton.edu
<zzhang@cs.binghamton.edu>; freebsd-hackers@freebsd.org
<freebsd-hackers@freebsd.org>; nectar@nectar.com <nectar@nectar.com>
=93=FA=8E=9E : 1999=94N10=8C=8E19=93=FA 1:51
Subject : Re: Search a symbol in the source tree


>On Mon, 18 Oct 1999, Tetsuro Teddy FURUYA wrote:
>
>> From: Jacques Vidrine <n@nectar.com>
>> Subject: Re: Search a symbol in the source tree
>> Date: Sun, 17 Oct 1999 11:37:11 -0500
>> n> On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA
(=3D?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=3D) <ht5t-fry@asahi-net.=
or.jp>
wrote:
>> n> > It seems queer to me that there has been none who has refered to
>> n> > find - exec
>> n> > pairs.
>> n> >
>> n> > You may type into shell like;
>> n> > $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less
>> n> > Here , "idt" is a search string.
>> n>
>> n> That's because no one wants a separate invocation of egrep for
>> n> every file!
>>                   ^^^^^^
>> Probably, except me !
>>
>> But, what various and interesting methods to search symbols there are =
!
>>
>> If we do not restrict the usage of search method, there might be
>> yet another methods.
>
>I frequently use find - grep when looking at a novel source tree.  The o=
ne
>problem with the solution given is that if you are looking for a few
>instances in hundreds of files, the hits can scroll off the screen and g=
et
>lost in the noise.   My prefered approach is:
>find . -name "*.[c]" -exec grep string {} /dev/null \;


Your idea to make grep read the dummy file /dev/null as multiple files re=
ad
is
elegant and splendid !
Finally, find with -exec option outputs the same listing as grep with -R
option and
find - xargs pipeline.

I have tried the bench mark test.

#Script started on Tue Oct 19 23:00:15 1999
#sh-2.02$  time find /usr/src/sys -name "*" -and -exec grep "-ia" idt {}
 \; -print > /dev/null
#real 1m14.920s
#user 0m16.454s
#sys 0m20.259s
#
#sh-2.02$ time find /usr/src/sys -name "*" -exec grep "-ia" idt {} /dev/n=
ull
\; > /dev/null
#real 1m16.742s
#user 0m16.289s
#sys 0m20.449s
#
#sh-2.02$ time find /usr/src/sys -name "*" | xargs grep "-ia" idt >
/dev/null
#real 0m44.862s
#user 0m0.989s
#sys 0m1.669s
#sh-2.02$ exit
#exit
#Script done on Tue Oct 19 23:16:04 1999

@@From this result, xargs is faster as it is predicted.
And the comsumed time to read /dev/null file is unexpectedly short.


>
>(the /dev/null forces grep to print the filename where a match is found,
>and I am an old fogey, learned grep before [ef]grep too lazy to learn
>better, should probably use fgrep)
>
>What I'd really like to see is a free implementation of cscope.
>
>Brian Beattie            | The only problem with
>beattie@aracnet.com      | winning the rat race ...
>www.aracnet.com/~beattie | in the end you're still a rat


Teddy Furuya <ht5t-fry@asahi-net.or.jp>




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991020025504I.tfuruya>