74 lines
2.0 KiB
HTML
74 lines
2.0 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>grep(1)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>grep(1)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
grep - search a file for lines containing a given pattern
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>grep</STRONG> [<STRONG>-elnsv</STRONG>] <EM>pattern</EM> [<EM>file</EM>] ...
|
|
|
|
|
|
</PRE>
|
|
<H2>OPTIONS</H2><PRE>
|
|
|
|
<STRONG>-e</STRONG> <STRONG>-e</STRONG> <EM>pattern</EM> is the same as <EM>pattern</EM>
|
|
|
|
<STRONG>-c</STRONG> Print a count of lines matched
|
|
|
|
<STRONG>-i</STRONG> Ignore case
|
|
|
|
<STRONG>-l</STRONG> Print file names, no lines
|
|
|
|
<STRONG>-n</STRONG> Print line numbers
|
|
|
|
<STRONG>-s</STRONG> Status only, no printed output
|
|
|
|
<STRONG>-v</STRONG> Select lines that do not match
|
|
|
|
|
|
</PRE>
|
|
<H2>EXAMPLES</H2><PRE>
|
|
|
|
<STRONG>grep</STRONG> <STRONG>mouse</STRONG> <STRONG>file</STRONG> # Find lines in <EM>file</EM> containing <EM>mouse</EM>
|
|
|
|
<STRONG>grep</STRONG> <STRONG>[0-9]</STRONG> <STRONG>file</STRONG> # Print lines containing a digit
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
|
|
<EM>Grep</EM> searches one or more files (by default, <EM>stdin</EM>) and selects out all
|
|
the lines that match the pattern. All the regular expressions accepted
|
|
by <EM>ed</EM> and <EM>mined</EM> are allowed. In addition, + can be used instead of * to
|
|
mean 1 or more occurrences, ? can be used to mean 0 or 1 occurrences, and
|
|
| can be used between two regular expressions to mean either one of them.
|
|
Parentheses can be used for grouping. If a match is found, exit status 0
|
|
is returned. If no match is found, exit status 1 is returned. If an
|
|
error is detected, exit status 2 is returned.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man1/cgrep.1.html">cgrep(1)</A></STRONG>, <STRONG><A HREF="../man1/fgrep.1.html">fgrep(1)</A></STRONG>, <STRONG><A HREF="../man1/sed.1.html">sed(1)</A></STRONG>, <STRONG><A HREF="../man9/awk.9.html">awk(9)</A></STRONG>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|