|
-a, --text
|
Process all files as text. Beware of binary output interpreted as commands.
|
|
--exclude=GLOB
|
Skip files whose base names match glob.
|
|
--exclude-
from=FILE |
Same as
--exclude but get list of globs from file |
|
--exclude-
dir=DIR |
Skip directories that match. Directories will also not be recursed.
|
|
-
I |
Don't match binary files
|
|
--include=GLOB
|
Search only for files matching glob.
|
|
-R, -r
|
Recurse directories
|
--exclude={*.xml,*.xsf} or --exclude-dir={.git,.vs,my\ dir}.
|
--line-buffered
|
Use line buffering on output. Can reduce performance.
|
|
-U
|
Treat file(s) as binary.
|
|
-z
|
Treat lines as zero byte terminated instead of newline
|
-q option)
ls -rt * | xargs grep -e 'searchtext'Searches through files in chronological order. |
|
-e PATTERN
|
Used to specify multiple patterns or protect patterns starting with "-"
|
|
-f FILE
|
Input file for patterns, one per line
|
|
-i
|
Ignore case
|
|
-v
|
Invert match
|
|
-w
|
Whole word matches only
|
|
-x
|
Match whole line only
|
|
-E
|
Extended regular expressions (ERE)
|
|
-F
|
Fixed strings
|
|
-G
|
Basic regular expressions (BRE)
|
|
-P
|
Perl regular expression (experimental?)
|
|
.
|
Match any character
|
|
[ ... ]
|
Match character list.
Use ^ to invert match. Specify ranges with hyphen ( -).Ranges can also be specified using a character class, e.g. number[[:digit:]]. Valid character classes are: [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:], [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:] |
|
?, *, +
|
Repetition operators indicating at most once, zero or more, or at least once, respectively.
|
|
{n}
|
Match exactly n times.
|
|
{n,}
|
Match at least n times.
|
|
{,m}
|
Match 0 to m times.
|
|
{n,m}
|
Match n to m times.
|
|
\<, \>
|
Match beginning or end of a word, respectively.
|
|
\b
|
Match both beginning and end of the word. \B matches the opposite.
|
|
\w
|
Match word character, aka
[[:alnum:]]. \W matches the opposite. |
|
\n
|
Backreference to previously matched group where
n is a single digit. |
?, +, {, |, (, and ).
|
-b
|
Print 0-based byte offset of match within file
|
|
-H
|
Print the file name for each match (default)
|
|
-h
|
Hide filename from output
|
|
-n
|
Prefix output with line number
|
|
-T
|
Ensure first line of content is tab-aligned for readability
|
|
-Z
|
Output a zero byte after file names
|
|
-c
|
Count number of lines
|
|
--color
[=WHEN] |
With no WHEN it will show colors when it's the final command in the pipe. WHEN is never, always, or auto.
|
|
-L
|
Show only names of files that do NOT match
|
|
-l
|
Show only names of matching files
|
|
-m
|
Max number of lines to read from any file
|
|
-o
|
Output only the matching text
|
|
-q
|
Quiet, no output
|
|
-s
|
Suppress error messages for missing or unreadable files
|
|
-A NUM
|
Print NUM lines of trailing context after match
|
|
-B NUM
|
Print NUM lines of lead context before match
|
|
-C NUM
|
Print NUM lines of context
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.