aboutsummaryrefslogtreecommitdiff
blob: a67123ed58b75329dbb903332e5be9effbb38969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0"?>
<guide self="tools-reference/grep/">
<chapter>
<title><c>grep</c>  Text Filtering</title>
<body>

<p>
The <c>grep</c> tool can be used to extract lines matching a given
regular expression from a file, or to check whether a given regular
expression matches any line in a file.
</p>

<p>
The usage is <c>grep "pattern" files</c>. If no files are specified,
text is read from the standard input. The <c>pattern</c> is a standard
basic regular expression, as described in
<uri link="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03">
IEEE Std 1003.1-2017, section 9.3</uri>.
</p>

<p>
If the <c>-E</c> argument is supplied, <c>pattern</c> is treated as
being an extended regular expression as described in
<uri link="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04">
IEEE Std 1003.1-2017, section 9.4</uri>.
</p>

<p>
If the <c>-F</c> argument is supplied, <c>pattern</c> is treated as
being a fixed string rather than a regular expression.
</p>

<p>
By default, <c>grep</c> prints out matching lines from the input. If
<c>-q</c> is specified, no output is displayed. If <c>-l</c> (lowercase
letter ell) is specified, only the filenames of files which contain
matching lines are displayed.
</p>

<p>
The <c>-v</c> option can be used to select lines which do not match the
pattern instead.
</p>

<p>
The <c>-s</c> option can be used to suppress messages about nonexistent or
unreadable files.
</p>

<p>
The return code can be used to test whether or not a match occurred. A
return code of <c>0</c> indicates that one or more matches occurred; a code
of <c>1</c> indicates no matches.
</p>

<p>
See <uri link="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html">
IEEE Std 1003.1-2017-grep</uri> for details. The grep-1 manual page on GNU
systems documents many non-portable additional features.
</p>

</body>
</chapter>
</guide>