Skip to content
Newer
Older
100644 129 lines (110 sloc) 5.8 KB
e057f31 @petdance rebuilt
authored Sep 5, 2010
1 Usage: ack [OPTION]... PATTERN [FILE]
7e56d22 @blixtor Added ack-help-dirs.txt as make target (and file).
blixtor authored Jan 10, 2010
2
e057f31 @petdance rebuilt
authored Sep 5, 2010
3 Search for PATTERN in each source file in the tree from cwd on down.
4 If [FILES] is specified, then only those files/directories are checked.
5 ack may also search STDIN, but only if no FILE are specified, or if
6 one of FILES is "-".
7e56d22 @blixtor Added ack-help-dirs.txt as make target (and file).
blixtor authored Jan 10, 2010
7
e057f31 @petdance rebuilt
authored Sep 5, 2010
8 Default switches may be specified in ACK_OPTIONS environment variable or
9 an .ackrc file. If you want no dependency on the environment, turn it
10 off with --noenv.
7e56d22 @blixtor Added ack-help-dirs.txt as make target (and file).
blixtor authored Jan 10, 2010
11
e057f31 @petdance rebuilt
authored Sep 5, 2010
12 Example: ack -i select
13
14 Searching:
15 -i, --ignore-case Ignore case distinctions in PATTERN
16 --[no]smart-case Ignore case distinctions in PATTERN,
17 only if PATTERN contains no upper case
18 Ignored if -i is specified
19 -v, --invert-match Invert match: select non-matching lines
20 -w, --word-regexp Force PATTERN to match only whole words
21 -Q, --literal Quote all metacharacters; PATTERN is literal
22
23 Search output:
24 --line=NUM Only print line(s) NUM of each file
25 -l, --files-with-matches
26 Only print filenames containing matches
27 -L, --files-without-matches
28 Only print filenames with no matches
29 -o Show only the part of a line matching PATTERN
30 (turns off text highlighting)
31 --passthru Print all lines, whether matching or not
32 --output=expr Output the evaluation of expr for each line
33 (turns off text highlighting)
34 --match PATTERN Specify PATTERN explicitly.
35 -m, --max-count=NUM Stop searching in each file after NUM matches
36 -1 Stop searching after one match of any kind
37 -H, --with-filename Print the filename for each match
38 -h, --no-filename Suppress the prefixing filename on output
39 -c, --count Show number of lines matching per file
40 --column Show the column number of the first match
41
42 -A NUM, --after-context=NUM
43 Print NUM lines of trailing context after matching
44 lines.
45 -B NUM, --before-context=NUM
46 Print NUM lines of leading context before matching
47 lines.
48 -C [NUM], --context[=NUM]
49 Print NUM lines (default 2) of output context.
50
51 --print0 Print null byte as separator between filenames,
52 only works with -f, -g, -l, -L or -c.
53
54 File presentation:
55 --pager=COMMAND Pipes all ack output through COMMAND. For example,
56 --pager="less -R". Ignored if output is redirected.
57 --nopager Do not send output through a pager. Cancels any
58 setting in ~/.ackrc, ACK_PAGER or ACK_PAGER_COLOR.
59 --[no]heading Print a filename heading above each file's results.
60 (default: on when used interactively)
61 --[no]break Print a break between results from different files.
62 (default: on when used interactively)
63 --group Same as --heading --break
64 --nogroup Same as --noheading --nobreak
65 --[no]color Highlight the matching text (default: on unless
66 output is redirected, or on Windows)
67 --[no]colour Same as --[no]color
68 --color-filename=COLOR
69 --color-match=COLOR
70 --color-lineno=COLOR Set the color for filenames, matches, and line numbers.
71 --flush Flush output immediately, even when ack is used
72 non-interactively (when output goes to a pipe or
73 file).
74
75 File finding:
76 -f Only print the files found, without searching.
77 The PATTERN must not be specified.
78 -g REGEX Same as -f, but only print files matching REGEX.
79 --sort-files Sort the found files lexically.
1276c6c @petdance adding --invert-file-match. NOW we release 1.93_02
authored Oct 6, 2010
80 --invert-file-match Print/search handle files that do not match -g/-G.
cdc92fd @blixtor Added option --show-types
blixtor authored Dec 25, 2009
81 --show-types Show which types each file has.
e057f31 @petdance rebuilt
authored Sep 5, 2010
82
83 File inclusion/exclusion:
84 -a, --all-types All file types searched;
85 Ignores CVS, .svn and other ignored directories
86 -u, --unrestricted All files and directories searched
87 --[no]ignore-dir=name Add/Remove directory from the list of ignored dirs
88 -r, -R, --recurse Recurse into subdirectories (ack's default behavior)
89 -n, --no-recurse No descending into subdirectories
90 -G REGEX Only search files that match REGEX
91
92 --perl Include only Perl files.
93 --type=perl Include only Perl files.
94 --noperl Exclude Perl files.
95 --type=noperl Exclude Perl files.
96 See "ack --help type" for supported filetypes.
97
98 --type-set TYPE=.EXTENSION[,.EXT2[,...]]
99 Files with the given EXTENSION(s) are recognized as
100 being of type TYPE. This replaces an existing
101 definition for type TYPE.
102 --type-add TYPE=.EXTENSION[,.EXT2[,...]]
103 Files with the given EXTENSION(s) are recognized as
104 being of (the existing) type TYPE
105
106 --[no]follow Follow symlinks. Default is off.
107
108 Directories ignored by default:
7e56d22 @blixtor Added ack-help-dirs.txt as make target (and file).
blixtor authored Jan 10, 2010
109 autom4te.cache, blib, _build, .bzr, .cdv, cover_db, CVS, _darcs, ~.dep,
15ff9d2 @petdance Added support for Go and Delphi. Ignores Monotone directories.
authored Oct 10, 2010
110 ~.dot, .git, .hg, _MTN, ~.nib, .pc, ~.plst, RCS, SCCS, _sgbak and .svn
e057f31 @petdance rebuilt
authored Sep 5, 2010
111
112 Files not checked for type:
0dd3497 @salty-horse Ignore minified javascript files
salty-horse authored Nov 21, 2010
113 /~$/ - Unix backup files
114 /#.+#$/ - Emacs swap files
e057f31 @petdance rebuilt
authored Sep 5, 2010
115 /[._].*\.swp$/ - Vi(m) swap files
0dd3497 @salty-horse Ignore minified javascript files
salty-horse authored Nov 21, 2010
116 /core\.\d+$/ - core dumps
9654b14 @hoelzro Spread min.js regex change where needed
hoelzro authored Sep 16, 2011
117 /[.-]min\.js$/ - Minified javascript files
e057f31 @petdance rebuilt
authored Sep 5, 2010
118
119 Miscellaneous:
120 --noenv Ignore environment variables and ~/.ackrc
121 --help This help
122 --man Man page
123 --version Display version & copyright
124 --thpppt Bill the Cat
125
126 Exit status is 0 if match, 1 if no match.
127
e6c3a4d @petdance Released ack 1.96
authored Sep 18, 2011
128 This is version 1.96 of ack.
Something went wrong with that request. Please try again.