sbase/grep.1

81 lines
2.0 KiB
Groff
Raw Normal View History

2011-05-23 01:36:34 +00:00
.TH GREP 1 sbase\-VERSION
.SH NAME
grep \- search files for a pattern
.SH SYNOPSIS
.B grep
2014-11-20 14:47:26 +00:00
.RB [ \-EFHchilnqsvx ]
2013-09-27 15:26:22 +00:00
.RB [ \-e
.I pattern ]
2014-11-20 16:57:49 +00:00
.RB [ \-f
.I file ]
2011-05-23 01:36:34 +00:00
.I pattern
.RI [ file ...]
.SH DESCRIPTION
.B grep
2011-06-18 05:42:24 +00:00
searches the input files for lines that match the
.IR pattern ,
a regular expression as defined in
2011-05-25 17:29:46 +00:00
.IR regex (7).
2011-05-23 01:36:34 +00: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 10:57:31 +00:00
.B \-E
2014-11-20 14:35:23 +00:00
Matches using extended regex.
.TP
.B \-F
Match using fixed strings. Treat each pattern specified as a string instead of a regular
expression.
2011-06-04 10:57:31 +00:00
.TP
2014-11-16 10:45:10 +00:00
.B \-H
2014-11-20 14:35:23 +00:00
Prefixes each matching line with its filename in the output. This is the
2014-11-16 10:45:10 +00:00
default when there is more than one file specified.
.TP
2011-05-23 01:36:34 +00:00
.B \-c
2014-11-20 14:35:23 +00:00
Prints only a count of matching lines.
2011-05-23 01:36:34 +00:00
.TP
2013-09-27 15:26:22 +00: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
2014-11-20 16:57:49 +00:00
.TP
.B \-f file
Read one or more patterns from the file named by the pathname file.
Patterns in file shall be terminated by a <newline>. A null pattern can be
specified by an empty line in pattern_file. Unless the -E or -F option is
also specified, each pattern shall be treated as a BRE.
2013-09-27 15:26:22 +00:00
(`-').
.TP
2014-11-16 19:03:25 +00:00
.B \-h
2014-11-20 14:35:23 +00:00
Do not prefix each line with 'filename:' prefix.
2014-11-16 19:03:25 +00:00
.TP
2011-05-23 01:36:34 +00:00
.B \-i
2014-11-20 14:35:23 +00:00
Matches lines case insensitively.
2011-05-23 01:36:34 +00:00
.TP
.B \-l
2014-11-20 14:35:23 +00:00
Prints only the names of files with matching lines.
2011-05-23 01:36:34 +00:00
.TP
.B \-n
2014-11-20 14:35:23 +00:00
Prefixes each matching line with its line number in the input.
2011-05-23 01:36:34 +00:00
.TP
.B \-q
2014-11-20 14:35:23 +00:00
Prints nothing, only returns status.
2011-05-23 01:36:34 +00:00
.TP
2014-11-20 14:14:26 +00:00
.B \-s
Suppress the error messages ordinarily written for nonexistent or unreadable files.
.TP
2011-05-23 01:36:34 +00:00
.B \-v
2014-11-20 14:35:23 +00:00
Selects lines which do
2011-05-23 01:36:34 +00:00
.B not
2014-11-20 14:35:23 +00:00
Match the pattern.
2014-11-20 14:47:26 +00:00
.TP
.B \-x
Consider only input lines that use all characters in the line excluding the terminating <newline> to
match an entire fixed string or regular expression to be matching lines.
2011-05-25 17:29:46 +00:00
.SH SEE ALSO
.IR regex (7)