Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2002 22:52:48 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Peter Leftwich <Hostmaster@Video2Video.Com>
Cc:        FreeBSD LIST <FreeBSD-Questions@FreeBSD.Org>
Subject:   Re: find vs. `ls -alR | grep -i keyword`
Message-ID:  <20020606035248.GB43707@dan.emsphone.com>
In-Reply-To: <20020605230722.V45306-100000@earl-grey.cloud9.net>
References:  <20020603031720.GA94033@dan.emsphone.com> <20020605230722.V45306-100000@earl-grey.cloud9.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jun 05), Peter Leftwich said:
> On Sun, 2 Jun 2002, Dan Nelson wrote:
> > "locate" beats them both (but works off a precomputed index).  find
> > will be faster, if only because it doesn't bother to print stats on
> > every file only to get most of it suppressed by grep.
> 
> It turns out my /var/db/locate.database file is 0 bytes and `man locate`
> doesn't exactly tell the use a good weight-gain formula for it... so I'll
> stick to beefing up my "find" command lines :)

Run /usr/libexec/locate.updatedb as root; that'll do it.  The database
is usually updated weekly.
 
> > > Invariably, I surprise myself when a conglomeration such as `find
> > > /cdrw -name "*deep\ water*" -print` actually prints useful
> > > information
> > no; you never need a slash after directories in any command, unless
> > it's an output file and you want to tell the command to create it,
> > and no; because your argument is quoted.  If you didn't quote it,
> > you would have had to write \*deep\ water\* .
> 
> Ah ha, learning is happening as I write this.  However, how would you
> locate a file named '***dan_is_really_cool***' if your extension to
> my example holds true? i.e. I used -name "*deep\ water*" and you used
> \*deep\ water\* for yours.

The same way you can escape special characters from the shell by
putting a \ in front of them, you can escape special characters from
find:

 -name pattern
             True if the last component of the pathname being examined
             matches pattern.  Special shell pattern matching
             characters (``['', ``]'', ``*'', and ``?'') may be used as
             part of pattern.  These characters may be matched
             explicitly by escaping them with a backslash (``\'').


-- 
	Dan Nelson
	dnelson@allantgroup.com

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




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