Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


locate | 12 comments | Create New Account
Click here to return to the 'locate' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
locate
Authored by: pmccann on Feb 05, '03 06:32:53PM

Gack! That "find" command will take forever!

Try locate (just once) and you'll be hooked: while it won't find
files that you've created/moved since the last database update,
most of the time your searching for stuff that you hasn't moved
recently, and locate will take orders of magnitude less time than
find.

% locate blah

to find all files with blah in the full path

More exotic stuff can be done by piping the output to grep (or even perl):

% locate \\* | grep pattern

(Just set up an alias if this is not easy to remember:

alias myloc "locate \\* | grep \\!* | less"

should do the trick if you're using tcsh.)

But everyone should know that "Locator" (pick of the week a couple of weeks ago)
is a great way to not have to worry about any of this stuff: it puts a nice cocoa skin around the locate+grep combination (actually locate+perl I think, for what it's worth).

Cheers,
Paul



[ Reply to This | # ]
Backslashitis
Authored by: pmccann on Feb 05, '03 06:37:03PM

AAARGH! I hate this thing: preview showed *no* backslashes when I used
a single backslash in those commands, so I doubled them up. Cool, so
preview displays them nicely as single backslashes, just as desired.

So... submit the thing and whaddyaknow: double backslashes and no edit
facility. Bring on the site upgrade! (The forums site has no problems
with such things.)

So just in case it's not obvious: each of the double backslashes in
my previous post should be single.

Sigh...



[ Reply to This | # ]
Backslashitis
Authored by: robg on Feb 05, '03 06:56:53PM

Sucks, doesn't it? Basically, you need two to get one most of the time, but each time you hit Preview, you lose one so you need to add it back. Yech.

The new engine features a [code] tag which leaves EVERYTHING in the tag alone (hooray!). It's also much smarter about handling these special characters, though I'm still not sure it's perfect -- but the mantra will be "use the [code] tag."

-rob.



[ Reply to This | # ]