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: Joe Koski
Subject: Re: finding .m files using 'locate'
Date: Fri, 15 Jul 2005 19:05:54 -0600
User-agent: Microsoft-Entourage/11.1.0.040913

on 7/15/05 3:50 PM, Mike Miller at address@hidden wrote:

> On Fri, 15 Jul 2005, Przemek Klosowski wrote:
> 
>>   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;
> 
> That's one that I didn't know, so thanks, but I conclude that this is the
> best approach:
> 
> locate '*.m' | perl -pe 's#(^.*)/[^/]+\.m#$1#g' | sort | uniq
> 

Back in the '80s, Byte Magazine reported the annual winner of the obfuscated
C contest. The object was to write a C program that actually did something,
but nobody could decide what it was. Maybe we should have and obfuscated
UNIX/perl contest.

Joe




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