App::Ack::Intro - An introduction to ack
Ack is a powerful alternative to grep for programmers. It's made to make a programmer's life easier by optimizing common tasks that programmers face every day.
Ack can easily be restricted so it only matches whole words,
not portions of words,
by adding either
ack --w skip
will match lines that have the word "skip" by itself, but will not match strings like "skipping" or "skipped".
This is identical to:
Are you tired of grep finding matches in your CVS, Subversion or Git directories? Even if no matches are found, searching those directories never returns references in source code. ack automatically ignores files contained in the directories for these popular version control systems and many others. If your VCS doesn't have directories already built into ack, you can add them by just adding
--ignore-dir lines to your .ackrc file.
Ack automatically ignores directories having to do with version control systems, but sometimes you just want to exclude a directory for the duration of one command. For example, to keep ack from searching your 'test' directory, use
Need to edit every perl file that calls a particular subroutine? Let ack not only find the files for you (restricting the search to perl files with the
--perl flag), but load them into your editor by using either
emacs $(ack -l --perl bad_subroutine)
Ack doesn't have to be installed system-wide for you to use it.
Copyright 2005-2010 Andy Lester.
This program is free software; you can redistribute it and/or modify it under the terms of either:
Off the topic of my head:
1. -h (--no-filename) , -l (only filenames) etc. Also exist in GNU grep, but they are still useful.
2. I have this in my .ackrc:
Add Website Meta Language files to .html. --type-add=html=.wml
# Add CMake files --type-set=cmake=.txt,.cmake
Other stuff can be added.
3. -i for case insensitive searches.
5. ack -f for displaying a list of files in the current directory that are not temporary/version-control-related/etc.
6. -a for showing all files.
7. Sometimes I use --nofollow (especially as root).
8. --print0 is useful with xargs (though I haven't used it a lot yet).