bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: locate(1) man page hard to understand, please rewrite


From: Miles Bader
Subject: Re: locate(1) man page hard to understand, please rewrite
Date: 08 Jul 2002 11:22:15 +0900

"Paul D. Smith" <address@hidden> writes:
> In fact, in shell pattern matching, unlike most regular expressions, the
> pattern must match the _entire_ filename.  So:
> 
>   $ locate /tmp
> 
> will match _only_ the exact path '/tmp'.  It will _NOT_ match anything
> containing '/tmp'; for the latter you need:
> 
>   $ locate '*/tmp*'

Actually, (as the man page notes) locate will do substring matching if
the search term contains no meta-characters, so `locate /tmp' will work.
If there are metacharacters, it requires the whole filename to match,
so you can do `locate */tmp' to locate filenames ending in `/tmp'.

> dj> $ locate /tmp | grep /tmp$   # best I can do I suppose

Why the grumble?  I think for more complicated searches, locate piped
into grep like this is the best thing to do, since it gives you all the
power of your favorite matcher with all the speed of locate, and really
isn't much harder to use than locate alone.

Perhaps the documentation ought to mention this usage explicitly.

-Miles
-- 
97% of everything is grunge



reply via email to

[Prev in Thread] Current Thread [Next in Thread]