On Tue, Nov 8, 2011 at 3:40 AM, James Youngman <j...@gnu.org> wrote: > On Tue, Nov 8, 2011 at 12:11 AM, Peng Yu <pengyu...@gmail.com> wrote: >> On Mon, Nov 7, 2011 at 5:47 PM, James Youngman <j...@gnu.org> wrote: >>> You can achieve this by using locate --regex. >> >> Suppose I want to restrict the search to /tmp, what regex I should specify? > > locate --regex '^/tmp\($\|/\)'
So if I want to search for some file pattern, I have to combine the regex for the file pattern with the directory regex into a single regex. What seems missing in locate is the operator like -and -or that are found in find. Since locate can be thought of a faster version find. I'd think the command line interface for 'locate' should be as close to 'find' as possible > I'm not working on it right now. But I think that it's a good idea > to move in this direction (and caching directory-level information > will also probably allow us to speed up indexing). Would you like to > work on this? I looked at the source code of updatedb. It essentially use find to generated the database and use frcode to compress the database, where the directory info should be add to the database? frcode is natural to compress strings with common suffix, is it also applicable when there is additional directory information? -- Regards, Peng