sbase/grep.1

69 lines
1.6 KiB
Groff

.TH GREP 1 sbase\-VERSION
.SH NAME
grep \- search files for a pattern
.SH SYNOPSIS
.B grep
.RB [ \-EFHchilnqsv ]
.RB [ \-e
.I pattern ]
.I pattern
.RI [ file ...]
.SH DESCRIPTION
.B grep
searches the input files for lines that match the
.IR pattern ,
a regular expression as defined in
.IR regex (7).
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
.B \-E
Matches using extended regex.
.TP
.B \-F
Match using fixed strings. Treat each pattern specified as a string instead of a regular
expression.
.TP
.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
.B \-c
Prints only a count of matching lines.
.TP
.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
.B \-h
Do not prefix each line with 'filename:' prefix.
.TP
.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 \-s
Suppress the error messages ordinarily written for nonexistent or unreadable files.
.TP
.B \-v
Selects lines which do
.B not
Match the pattern.
.SH SEE ALSO
.IR regex (7)