-.\" $OpenBSD: grep.1,v 1.44 2017/12/09 18:38:37 pirofti Exp $
+.\" $OpenBSD: grep.1,v 1.45 2017/12/10 09:17:24 jmc Exp $
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\"
.\" @(#)grep.1 8.3 (Berkeley) 4/18/94
.\"
-.Dd $Mdocdate: December 9 2017 $
+.Dd $Mdocdate: December 10 2017 $
.Dt GREP 1
.Os
.Sh NAME
.Op Fl -binary-files Ns = Ns Ar value
.Op Fl -context Ns Op = Ns Ar num
.Op Fl -line-buffered
+.Op Fl -max-count Ns = Ns Ar num
.Op Ar pattern
.Op Ar
.Ek
.It Fl b
The offset in bytes of a matched pattern is
displayed in front of the respective matched line.
-.It Fl C Ns Op Ar num
+.It Fl C Ns Oo Ar num Oc , Fl -context Ns Op = Ns Ar num
Print
.Ar num
lines of leading and trailing context surrounding each match.
If the standard input is searched, the string
.Dq (standard input)
is written.
-.It Fl m Ar num, Fl Fl max-count Ns = Ns Ar num
+.It Fl m Ar num , Fl -max-count Ns = Ns Ar count
Stop after
.Ar num
matches.
.Nm grep
to behave as
.Nm zgrep .
-.It Fl Fl binary-files Ns = Ns Ar value
+.It Fl -binary-files Ns = Ns Ar value
Controls searching and printing of binary files.
Options are
.Ar binary ,
and
.Ar text :
treat all files as text.
-.Sm off
-.It Fl Fl context Op = Ar num
-.Sm on
-Print
-.Ar num
-lines of leading and trailing context.
-The default is 2.
-.It Fl Fl line-buffered
+.It Fl -line-buffered
Force output to be line buffered.
By default, output is line buffered when standard output is a terminal
and block buffered otherwise.
One or more lines were selected.
.It Li 1
No lines were selected.
-.It Li \*(Gt1
+.It Li >1
An error occurred.
.El
.Sh EXAMPLES
-/* $OpenBSD: grep.c,v 1.56 2017/12/09 18:38:37 pirofti Exp $ */
+/* $OpenBSD: grep.c,v 1.57 2017/12/10 09:17:24 jmc Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
{
fprintf(stderr,
#ifdef NOZ
- "usage: %s [-abcEFGHhIiLlnoqRsUVvwx] [-A num] [-B num] [-C[num]]\n"
+ "usage: %s [-abcEFGHhIiLlnoqRsUVvwx] [-A num] [-B num] [-C[num]]"
#else
- "usage: %s [-abcEFGHhIiLlnoqRsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
+ "usage: %s [-abcEFGHhIiLlnoqRsUVvwxZ] [-A num] [-B num] [-C[num]]"
#endif
- "\t[-e pattern] [-f file] [-m num] [--binary-files=value]\n"
- "\t[--context[=num]] [--line-buffered] [pattern] [file ...]\n",
+ " [-e pattern]\n"
+ "\t[-f file] [-m num] [--binary-files=value] [--context[=num]]\n"
+ "\t[--line-buffered] [--max-count=num] [pattern] [file ...]\n",
__progname);
exit(2);
}