I'm using ack (sometimes distributed as ack-grep) to search through a complex directory of code, images, who knows what else, and it's reacting pretty slowly. How can I diagnose what it is searching through that is making it slow, so that I can have it ignore 'em?
I just realized that the reasons that my ack-grep are slow will probably make grep slow for the same reason, so I've changed the wording of the title to refer to both.
Current ack-grep command alias:
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 "$@"
}
So I do a case-insensitive search on some string via that alias, e.g. view "Oops! Required fields"
, ignoring certain directories.
I guess what I could really use is a "verbose" mode to either grep or ack-grep, so that I can visually see subdirectories that it hangs around on because they're slow to search.
Ended up using the -L switch to make it output all the files that it matches, for quick visual diagnosis of problems. Used just the command structure below:
ack-grep -L "Oops! Required fields were not all completed."