File Exchange

image thumbnail

mfilegrep

version 1.0 (3.76 KB) by

Returns the names of all m-files within the specified path containing a specified search string.

1 Download

Updated

View License

Like the "grep" functionality in the GNU Project, this program searches files for the presence of a search string. However, mfilegrep searches only mfiles. Searches can be recursive or non-recursive, and case-sensitive or non-case-sensitive, and can search for whole words or partial words. The result is returned in a cell array that contains the names of all mfiles on the specified path that contain the search string. Additionally, the user has the option of listing the text of all lines in the mfiles containing the search string.

Comments and Ratings (4)

John D'Errico

Careful application of profile to mfilegrep found a spare call to intersect. Long searches spent 90% of their time in that one line. I've fixed that, and several other (minor) bugs in mgrep.

Karl-Heinz Rigerl

Great for cleaning up bigger applications, same name for same variables in all m-files.

Bill Driscoll

Thank you, Brett, for this great routine. I find mfilegrep more convenient than dos('grep etc etc').

Harvey Greenberg

Very useful!

Updates

I omitted one of the possible input arguments in my descriptive comments.

MATLAB Release
MATLAB 6.1 (R12.1)
Acknowledgements

Inspired: mgrep

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video