通过复杂的目录(代码,文件,php脚本等)诊断缓慢的grep或ack搜索,以便更快地重复使用

Kzq*_*qai 5 search grep organization ack

我正在使用ack(有时分布为ack-grep)来搜索复杂的代码目录,图像,谁知道还有什么,而且反应非常缓慢.我如何诊断它正在搜索的是什么使它变慢,以便我可以让它忽略它们?

我刚刚意识到我的ack-grep很慢的原因可能会因为同样的原因而使grep变慢,所以我改变了标题的措辞以引用两者.

当前的ack-grep命令别名:

function view ()
{
echo "ack-grep -i $@ // ignoring third-party directories"
ack-grep -i --ignore-dir=third-party --ignore-dir="unclean-files" --ignore-dir=FCKeditor --ignore-dir=smarty --ignore-dir=codepress --ignore-dir=yui "$@"
}
Run Code Online (Sandbox Code Playgroud)

因此,我通过该别名对某些字符串进行不区分大小写的搜索,例如view "Oops! Required fields",忽略某些目录.

我想我真正可以使用的是greb或ack-grep的"详细"模式,这样我就可以在视觉上看到它挂起的子目录,因为它们搜索速度很慢.

Kzq*_*qai 5

最终使用 -L 开关使其输出所有匹配的文件,以便快速直观地诊断问题。仅使用以下命令结构:

ack-grep -L "Oops! Required fields were not all completed."