GREP(1) GREP(1)
[options] PATTERN [FILE...]
grep [options] [-e PATTERN | -f FILE] [FILE...]
grep
FILE
( file
- ) PATTERN
grep
2 egrep
fgrep
egrep
grep -E
fgrep
grep -F
zgrep
grep -Z
-A NUM, --after-context=NUM
NUM
-a, --text
--binary-files=text
-B NUM, --before-context=NUM
NUM
-C [NUM], -NUM, --context[=NUM]
NUM
( 2)
-b, --byte-offset
--binary-files=TYPE
TYPE
TYPE
binary
grep
TYPE
without-match
grep
-I
TYPE
text
grep
-a
: grep --binary-files=text
-c, --count
-v, --invert-match
()
-d ACTION, --directories=ACTION
ACTION
ACTION
read
ACTION
skip
ACTION
recurse
grep
-r
-E, --extended-regexp
PATTERN
()
-e PATTERN, --regexp=PATTERN
PATTERN
-
-F, --fixed-strings
PATTERN
-f FILE, --file=FILE
FILE
1
-G, --basic-regexp
PATTERN
()
-H, --with-filename
-h, --no-filename
--help
-I --binary-files=without-match
-i, --ignore-case
PATTERN
-L, --files-without-match
-l, --files-with-matches
--mmap read(2)
mmap(2)
--mmap
grep
I/O --mmap
()
-n, --line-number
-q, --quiet, --silent
-s
--no-messages
-r, --recursive
-d recurse
-s, --no-messages
: GNU grep
grep
POSIX.2 grep
-q
-s
GNU grep
-q
grep
-q
-s
/dev/null
-U, --binary
MS-DOS MS-Windows grep
32KB
grep
( ^
$
) CR -U
CR/LF
MS-DOS MS-Windows
-u, --unix-byte-offsets
unix grep
unix
CR
grep
Unix
-b
MS-DOS MS-Windows
-V, --version
grep
()
-v, --invert-match
-w, --word-regexp
-x, --line-regexp
-y -i
--null 0 (ASCII NUL )
grep -l --null
newline 0
newline
find -print0, perl -0, sort -z, xargs -0
newline
-Z, --decompress
zlib
grep
2 GNU grep
1
[
]
1
^
[0123456789]
1
(`-')
[:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:],
[:print:], [:punct:], [:space:], [:upper:], [:xdigit:]
[[:alnum:]]
[0-9A-Za-z]
POSIX ASCII
( )
]
^
-
.
1
\w
[[:alnum:]]
\W
[^[:alnum:]]
^
$
\<
\>
\b
\B
? 1
* 0
+ 1
{n} n
{n,} n
{n,m} n
m
2
2 2
2 |
n
1
\n
n
?, +, {, |, (, )
\?, \+, \{, \|, \(, \)
egrep
{
\{
egrep
{
egrep
{
[{]
GNU egrep
{
egrep '{1' 2 {1
POSIX.2
GREP_OPTIONS
GREP_OPTIONS
'--binary-files=without-match --directories=skip'
grep
2 --binary-files=without-match
--directories=skip
LC_ALL, LC_MESSAGES, LANG
grep
LC_MESSAGES
grep
(NLS)
LC_ALL, LC_CTYPE, LANG
LC_CTYPE
grep
(NLS) POSIX
POSIXLY_CORRECT
grep
POSIX.2 grep
GNU POSIX.2
POSIX.2 " (illegal)"
" (invalid)"
0
1 ( -v )
2
Email "Subject:" "grep"
{m,n}
grep
GNU Project 2000/06/09 GREP(1)