sbase/grep.1

59 lines
1.3 KiB
Groff
Raw Normal View History

2011-05-22 21:36:34 -04:00
.TH GREP 1 sbase\-VERSION
.SH NAME
grep \- search files for a pattern
.SH SYNOPSIS
.B grep
2014-11-16 05:45:10 -05:00
.RB [ \-EHcilnqv ]
2013-09-27 11:26:22 -04:00
.RB [ \-e
.I pattern ]
2011-05-22 21:36:34 -04:00
.I pattern
.RI [ file ...]
.SH DESCRIPTION
.B grep
2011-06-18 01:42:24 -04:00
searches the input files for lines that match the
.IR pattern ,
a regular expression as defined in
2011-05-25 13:29:46 -04:00
.IR regex (7).
2011-05-22 21:36:34 -04:00
By default each matching line is printed to stdout. If no file is given, grep
reads from stdin.
.P
The status code is 0 if any lines match, and 1 if not. If an error occurred the
status code is 2.
.SH OPTIONS
.TP
2011-06-04 06:57:31 -04:00
.B \-E
matches using extended regex.
.TP
2014-11-16 05:45:10 -05:00
.B \-H
prefixes each matching line with its filename in the output. This is the
default when there is more than one file specified.
.TP
2011-05-22 21:36:34 -04:00
.B \-c
prints only a count of matching lines.
.TP
2013-09-27 11:26:22 -04:00
.B \-e pattern
Specify a pattern used during the search of the input: an input
line is selected if it matches any of the specified patterns.
This option is most useful when multiple -e options are used to
specify multiple patterns, or when a pattern begins with a dash
(`-').
.TP
2011-05-22 21:36:34 -04:00
.B \-i
matches lines case insensitively.
.TP
.B \-l
prints only the names of files with matching lines.
.TP
.B \-n
prefixes each matching line with its line number in the input.
.TP
.B \-q
prints nothing, only returns status.
.TP
.B \-v
selects lines which do
.B not
match the pattern.
2011-05-25 13:29:46 -04:00
.SH SEE ALSO
.IR regex (7)