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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
<head>
<title>grep(1) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>GREP(1)</b><td align=right><b>GREP(1)</b>
<tr><td width=20><td colspan=2>
<br>
<p><font size=+1><b>NAME </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
grep, g – search a file for a pattern<br>
</table>
<p><font size=+1><b>SYNOPSIS </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>grep</font></tt> [ <i>option ...</i> ] <i>pattern</i> [ <i>file ...</i> ]
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<tt><font size=+1>g</font></tt> [ <i>option ...</i> ] <i>pattern</i> [ <i>file ...</i> ]<br>
</table>
<p><font size=+1><b>DESCRIPTION </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<i>Grep</i> searches the input <i>files</i> (standard input default) for lines
that match the <i>pattern</i>, a regular expression as defined in <a href="../man7/regexp.html"><i>regexp</i>(7)</a>
with the addition of a newline character as an alternative (substitute
for <tt><font size=+1>|</font></tt>) with lowest precedence. Normally, each line matching the
pattern is ‘selected’, and each selected line is copied to
the standard output. The options are<br>
<tt><font size=+1>−c</font></tt> Print only a count of matching lines.<br>
<tt><font size=+1>−h</font></tt> Do not print file name tags (headers) with output lines.<br>
<tt><font size=+1>−e</font></tt> The following argument is taken as a <i>pattern</i>. This option makes
it easy to specify patterns that might confuse argument parsing,
such as <tt><font size=+1>−n</font></tt>.<br>
<tt><font size=+1>−i</font></tt> Ignore alphabetic case distinctions. The implementation folds
into lower case all letters in the pattern and input before interpretation.
Matched lines are printed in their original form.<br>
<tt><font size=+1>−l</font></tt> (ell) Print the names of files with selected lines; don’t print
the lines.<br>
<tt><font size=+1>−L</font></tt> Print the names of files with no selected lines; the converse
of <tt><font size=+1>−l</font></tt>.<br>
<tt><font size=+1>−n</font></tt> Mark each printed line with its line number counted in its file.<br>
<tt><font size=+1>−s</font></tt> Produce no output, but return status.<br>
<tt><font size=+1>−v</font></tt> Reverse: print lines that do not match the pattern.<br>
<tt><font size=+1>−f</font></tt> The pattern argument is the name of a file containing regular
expressions one per line.<br>
<tt><font size=+1>−b</font></tt> Don’t buffer the output: write each output line as soon as it
is discovered.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
Output lines are tagged by file name when there is more than one
input file. (To force this tagging, include <tt><font size=+1>/dev/null</font></tt> as a file
name argument.)
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
Care should be taken when using the shell metacharacters <tt><font size=+1>$*[^|()=\</font></tt>
and newline in <i>pattern</i>; it is safest to enclose the entire expression
in single quotes <tt><font size=+1>'</font></tt>...<tt><font size=+1>'</font></tt>. An expression starting with ’*’ will treat
the rest of the expression as literal characters.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>G</i> invokes grep with <tt><font size=+1>−n</font></tt> and forces tagging of output lines by file
name. If no files are listed, it searches all files matching<br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>*.C *.b *.c *.h *.m *.cc *.java *.py *.tex *.ms<br>
</font></tt>
</table>
</table>
<p><font size=+1><b>SOURCE </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>/usr/local/plan9/src/cmd/grep<br>
/usr/local/plan9/bin/g<br>
</font></tt>
</table>
<p><font size=+1><b>SEE ALSO </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<a href="../man1/ed.html"><i>ed</i>(1)</a>, <a href="../man1/awk.html"><i>awk</i>(1)</a>, <a href="../man1/sed.html"><i>sed</i>(1)</a>, <a href="../man1/sam.html"><i>sam</i>(1)</a>, <a href="../man7/regexp.html"><i>regexp</i>(7)</a><br>
</table>
<p><font size=+1><b>DIAGNOSTICS </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
Exit status is null if any lines are selected, or non-null when
no lines are selected or an error occurs.<br>
</table>
<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>
|