mgrep

バージョン 1.0.0.0 (5.14 KB) 作成者: John D'Errico
Returns the names of all m-files in a directory or directory tree that contain a search string.
ダウンロード: 3.6K
更新 2008/2/21

ライセンスの表示

Long ago, I found that I quite liked Brett Shoelson's function mfilegrep, but back then it had a bug in it. I found the bug and fixed it, so then I decided to update the interface. I really wanted a command form version for my own use.

The guts of mgrep are still all very much thanks to Brett though (but with many changes.) Compared to the current version of mfilegrep, mgrep is a little faster, perhaps a 25% improvement in speed for long searches.

The interface to mgrep is a property/value pair interface. Its all fully functional as a command or as a function call. Note that property names can be shortened to a single character, and can be provided in any order.

Directories may be specified in either an absolute form, with the complete path, or as a relative path starting from some directory.

Some example uses:

Recursive search for the string 'fmin', starting in the current directory, returning the result as a cell array. Any of these 3 alternatives will work, due to the use of defaults for every parameter but the search string.

filelist = mgrep('fmin');
filelist = mgrep('fmin','.');
filelist = mgrep('fmin',pwd,'recurse','on');

Simple search of the directory './mylocaldir' for the string 'fmin', display the result in the command window. Do not search subdirectories.

mgrep fmin ./mylocaldir recurse off

Case sensitive search for the name "John D'Errico", through all subdirectories beginning with the current directory. Display the results in the command window.

mgrep 'John D''Errico' . c on r on

引用

John D'Errico (2024). mgrep (https://www.mathworks.com/matlabcentral/fileexchange/9594-mgrep), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R14SP1
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersFile Operations についてさらに検索
タグ タグを追加
謝辞

ヒントを得たファイル: mfilegrep

ヒントを与えたファイル: contains_multi, Find 'orphaned' m-files, Toward a program development and documentation toolbox, orphan_libs(test, trgt)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0

Discussions with Brett found a few new ways to improve the code.