[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
-------------------------------------------------------------
- finding .m files using 'locate', Mike Miller, 2005/07/15
- Re: finding .m files using 'locate',
Przemek Klosowski <=
- Re: finding .m files using 'locate', Przemek Klosowski, 2005/07/18
- Re: finding .m files using 'locate', Mike Miller, 2005/07/19
- Re: finding .m files using 'locate', Mike Miller, 2005/07/19
- SV: finding .m files using 'locate', Peter J. Acklam, 2005/07/19
- Re: SV: finding .m files using 'locate', Mike Miller, 2005/07/19