mirror of
git://git.suckless.org/sbase
synced 2026-01-27 05:54:08 +00:00
From ed5e4d34a16436a37c0e084666fcfb77cc4859c3 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Thu, 31 Jul 2025 14:42:59 +0200 Subject: [PATCH 4/4] improve man pages and some warnings. Checking for warnings: mandoc -Tlint *.1 - Swap .St -p1003.1-2013 macro with text: mdoc does not support this macro and some texts were changed, like commit d4dfd42d3580ad36bedfdc5b8924ff6683981f53 - Typo fixes: exeption -> exception. - xargs.1: document -P extension. - sed.1: remove use of .Pp of .Ss. - Wrap lines to less than 80 characters and use a new sentence for each line. - find.1: Xr reference C library functions.
95 lines
2.3 KiB
Groff
95 lines
2.3 KiB
Groff
.Dd October 8, 2015
|
|
.Dt GREP 1
|
|
.Os sbase
|
|
.Sh NAME
|
|
.Nm grep
|
|
.Nd search files for patterns
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl EFHchilnqsvx
|
|
.Op Fl e Ar pattern
|
|
.Op Fl f Ar file
|
|
.Op Ar pattern
|
|
.Op Ar file ...
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
searches the input files for lines that match the
|
|
.Ar pattern ,
|
|
a regular expression as defined in
|
|
.Xr regex 7 or
|
|
.Xr re_format 7 .
|
|
By default each matching line is printed to stdout.
|
|
If no
|
|
.Ar file
|
|
is given
|
|
.Nm
|
|
reads from stdin.
|
|
.Sh OPTIONS
|
|
.Bl -tag -width Ds
|
|
.It Fl E
|
|
Match using extended regex.
|
|
.It Fl F
|
|
Match using fixed strings.
|
|
Treat each pattern specified as a string instead of a regular
|
|
expression.
|
|
.It Fl H
|
|
Prefix each matching line with its filename in the output.
|
|
This is the default when there is more than one file specified.
|
|
.It Fl c
|
|
Print only a count of matching lines.
|
|
.It Fl e Ar 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.
|
|
.It Fl f Ar 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.
|
|
(`-').
|
|
.It Fl h
|
|
Do not prefix each line with 'filename:' prefix.
|
|
.It Fl i
|
|
Match lines case insensitively.
|
|
.It Fl l
|
|
Print only the names of files with matching lines.
|
|
.It Fl n
|
|
Prefix each matching line with its line number in the input.
|
|
.It Fl q
|
|
Print nothing, only return status.
|
|
.It Fl s
|
|
Suppress the error messages ordinarily written for nonexistent or unreadable
|
|
files.
|
|
.It Fl v
|
|
Select lines which do
|
|
.Sy not
|
|
match the pattern.
|
|
.It Fl w
|
|
The expression is searched for as a word (as if surrounded by '\\<' and '\\>').
|
|
.It Fl 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.
|
|
.El
|
|
.Sh EXIT STATUS
|
|
.Bl -tag -width Ds
|
|
.It 0
|
|
One or more lines were matched.
|
|
.It 1
|
|
No lines were matched.
|
|
.It > 1
|
|
An error occurred.
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr sed 1 ,
|
|
.Xr re_format 7 ,
|
|
.Xr regex 7
|
|
.Sh STANDARDS
|
|
POSIX.1-2013.
|
|
.Pp
|
|
The
|
|
.Op Fl Hhw
|
|
flags are an extension to that specification.
|