[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Finding .m files on Mac with Tiger
From: |
Mike Miller |
Subject: |
Re: Finding .m files on Mac with Tiger |
Date: |
Fri, 15 Jul 2005 18:43:29 -0500 (CDT) |
On Fri, 15 Jul 2005, Paul Kienzle wrote:
locate is also very useful:
locate .m
Usually you need to use it with grep:
locate .m | grep "filt.*[.]m$" ;# find all filt*.m files
But won't that match things like this:
/home/bob/filth/porn.m
I'm only half joking - the thing is that the '.*' in the regex could match
a slash '/' and the 'filt' could be part of a directory name. I think
this will do it correctly:
locate "*.m" | egrep 'filt[^/]*\.m$'
the '[^/]*' means that between 'filt' and '.m' there may be any number of
non-slash characters. The '$' may be unnecessary because the '*' is
"greedy" and the "*.m" in the locate command insures that every line ends
in '.m'
locate uses a database created by updatedb. I don't remember doing
anything to enable it, but this is an inherited mac, so your milage may
vary.
Yes, the updatedb is key. It might not be searching the entire disk or
disk array and you have to know what it is doing. It also will have
indexed things some time ago, but how long? It depends on your settings.
In my system, it runs as a root crontab. There are security issues too.
Mike
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------