help-octave
[Top][All Lists]
Advanced

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

Re: finding .m files using 'locate'


From: Przemek Klosowski
Subject: Re: finding .m files using 'locate'
Date: Fri, 15 Jul 2005 15:44:26 -0400 (EDT)

   command.  Here is a way to get a list of every directory that contains at 
   least one file with the .m extension:

   locate .m | egrep '\.m$' | perl -pe 's#(^.*)/[^/]+.m#$1#g' | sort | uniq

Or, more simply:

   locate '*.m' | xargs -i dirname '{}' | uniq 

Explanation: locate treats *.m differently from simple .m by anchoring
it at the end; xargs runs dirname to strip the filenames (quotes to
protect against shell matching and non-alphanumerics in filenames). 
Sort is not necessary because locate sorts its data.



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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