假设我们有一个包含 100 个文件的项目(例如一个库),每个文件包含大约 1000 行代码。 你想找到函数 awesome_foo(...) 你怎么做呢?老实说,我发现 grepping 它令人毛骨悚然且无效......
编辑:我主要寻找函数定义
最佳答案
grep -irnw "awesome_foo"*
肯定会给你结果。
参数是:
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files.
-n, --line-number
Prefix each line of output with the line number within its input file.
-R, -r, --recursive
Read all files under each directory, recursively; this is equivalent to the -d recurse option.
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word con- stituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word- constituent characters are letters, digits, and the underscore.
关于c++ - 在大型项目中按名称查找函数的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16234116/