h, -no-filename Suppress the prefixing of filenames on output when multiple files are searched. H, -with-filename Print the filename for each match. This is the default when output is redirected. nogroup prints one result per line, like grep. This is the default when used interactively. group, -nogroup -group groups matches by file name with. This option is a convenience shortcut for -f -G g REGEX Print files where the relative path + filename matches REGEX.
The options -i, -w, -v, and -Q do not apply to this REGEX. The entire path and filename are matched against REGEX ,Īnd REGEX is a Perl regular expression, not a shell glob. G REGEX Only paths matching REGEX are included in the search. follow, -nofollow Follow or don't follow symlinks, other than whatever starting files or directories were specified on the command line.
PATTERN must not be specified, or it will be taken as a Only print the files that would be searched, without actually doing any searching. This is off by default unless ack is running interactively (when output goes to a pipe or file). flush -flush flushes output immediately. ackrc is read and all environment variables are ignored. env, -noenv -noenv disables all environment processing. This is helpful for editors that can place your cursor at a given position. column Show the column number of the first match. color-lineno= color Sets the color to be used for line numbers. color-match= color Sets the color to be used for matches. color-filename= color Sets the color to be used for filenames. On Windows, this option is off by default unless the Win32::Console::ANSI module is installed or the "ACK_PAGER_COLOR" environment variable is This is on by default unless the output is redirected. color, -nocolor -color highlights the matching text. If combined with -h ( -no-filename) ack outputs only one total count. Without -l, some line counts may be zeroes. If -l is in effect, it will only show the number of lines forĮach file that has lines matching. c, -count Suppress normal output instead print a count of matching lines for each input file. C, -context Print NUM lines (default 2) of context around matching lines. B NUM, -before-context= NUM Print NUM lines of leading context before matching lines.
A NUM, -after-context= NUM Print NUM lines of trailing context after matching lines. a, -all Operate on all files, regardless of type (but still skip directories like blib, CVS, etc.) If your script or parent program uses grep "-quiet" or "-silent" or needs exit 2 on IO error, use The option may be repeated to add/remove multiple directories from the ignore list.įor a complete list of directories that do not get searched, run ack -help.Īck trumps grep as an everyday tool 99% of the time, but don't throw grep away, because there are times you'll still need it.Į.g., searching through huge files looking for regexes that can be expressed with grep syntax should be quicker with grep. You may add or remove a directory from this list with the -ignore-dir However, it will ignore the shadow directories used by many versionĬontrol systems, and the build directories used by the Perl MakeMaker system. Furthermore, by specifying the -u option all files willĪck descends through the directory tree of the starting directories specified. Coredumps: Files matching core.\d+ However, ack always searches the files given on the command line, no matter what type.Backup files: Files matching #*# or ending with ~.Some files will never be selected by ack, even with -a, including: The -a option tells ack to select all files, regardless of type. If you have a file called foo.wango, and ack doesn't know With no file selections, ack only searches files of types that it recognizes. These selections can be made with the -type option. It knows about certain file types, based on both the extension on the file and, in some cases, theĬontents of the file. By default, ack prints the matching lines.Īck can also list files that would be searched, without actually searching them, to let you take advantage of ack's file-type filteringĪck is intelligent about the files it searches. Ack is designed as a replacement for 99% of the uses of grep.Īck searches the named input FILEs (or standard input if no files are named, or the file name - is given) for lines containing a match to the given