From owner-man-jp-reviewer@jp.freebsd.org  Fri Jan 28 11:05:54 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id LAA83671;
	Fri, 28 Jan 2000 11:05:54 +0900 (JST)
	(envelope-from owner-man-jp-reviewer@jp.FreeBSD.org)
Received: from mailgw1.be.to (mailgw1.be.to [210.235.212.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id LAA83644
	for <man-jp-reviewer@jp.freebsd.org>; Fri, 28 Jan 2000 11:05:53 +0900 (JST)
	(envelope-from okazaki@be.to)
Received: from mail1.be.to (point1.be.to [210.235.212.29])
	by mailgw1.be.to (8.9.3+3.2W/BETO.2.1-2000011019000035) with ESMTP id LAA16715
	for <man-jp-reviewer@jp.freebsd.org>; Fri, 28 Jan 2000 11:05:48 +0900
Received: from acidrain (ppp22-Mobara1.mtci.ne.jp [210.172.1.224])
	by mail1.be.to (8.8.8+3.0Wbeta13/BETO.2.0-1999110714000000) with SMTP id LAA24447
	for <man-jp-reviewer@jp.freebsd.org>; Fri, 28 Jan 2000 11:05:42 +0900
Received: (qmail 1786 invoked from network); 28 Jan 2000 02:02:15 -0000
Received: from localhost (HELO acidrain.localnet) (127.0.0.1)
  by localhost with SMTP; 28 Jan 2000 02:02:15 -0000
Date: Fri, 28 Jan 2000 11:02:14 +0900
Message-ID: <861z7354yh.wl@dolphin.be.to>
From: OKAZAKI Tetsurou <okazaki@be.to>
To: man-jp-reviewer@jp.freebsd.org
User-Agent: Wanderlust/2.2.16 (No Son Of Mine) SEMI/1.13.7 (Awazu)
 CLIME/1.13.6 (=?ISO-2022-JP?B?GyRCQ2YlTj4xGyhC?=) Emacs/20.5
 (i386--freebsd) MULE/4.0 (HANANOEN)
Organization: Unknown
MIME-Version: 1.0 (split by SEMI 1.13.7 - "Awazu")
Content-Type: message/partial; id="Fri_Jan_28_11:02:04_2000@acidrain.localnet"; number=2; total=2
Reply-To: man-jp-reviewer@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+990727
X-Sequence: man-jp-reviewer 1969
Subject: [man-jp-reviewer 1969] grep.1 (4.0-20000105-CURRENT update) (2/2)
Errors-To: owner-man-jp-reviewer@jp.freebsd.org
Sender: owner-man-jp-reviewer@jp.freebsd.org
X-Originator: okazaki@be.to

+.BI \-e " PATTERN" "\fR,\fP \-\^\-regexp=" PATTERN
 Use
-.I pattern
+.I PATTERN
 as the pattern; useful to protect patterns beginning with
 .BR \- .
 .TP
-.BI \-f " file"
-Obtain the pattern from
-.IR file .
+.BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE
+Obtain patterns from
+.IR FILE ,
+one per line.
+The empty file contains zero patterns, and therfore matches nothing.
 .TP
-.B \-h
+.BR \-H ", " \-\^\-with-filename
+Print the filename for each match.
+.TP
+.BR \-h ", " \-\^\-no-filename
 Suppress the prefixing of filenames on output
 when multiple files are searched.
 .TP
-.B \-i
+.BR \-i ", " \-\^\-ignore-case
 Ignore case distinctions in both the
 .I pattern
 and the input files.
 .TP
-.B \-L
+.BR \-L ", " \-\^\-files-without-match
 Suppress normal output; instead print the name
 of each input file from which no output would
-normally have been printed.
+normally have been printed.  The scanning will stop
+on the first match.
 .TP
-.B \-l
+.BR \-l ", " \-\^\-files-with-matches
 Suppress normal output; instead print
 the name of each input file from which output
-would normally have been printed.
+would normally have been printed.  The scanning will
+stop on the first match.
 .TP
-.B \-n
+.BR \-n ", " \-\^\-line-number
 Prefix each line of output with the line number
 within its input file.
 .TP
-.B \-q
-Quiet; suppress normal output.
-.TP
+.BR \-q ", " \-\^\-quiet ", " \-\^\-silent
+Quiet; suppress normal output.  The scanning will stop
+on the first match.
+Also see the
 .B \-s
+or
+.B \-\^\-no-messages
+option below.
+.TP
+.BR \-r ", " \-\^\-recursive
+Read all files under each directory, recursively;
+this is equivalent to the
+.B "\-d recurse"
+option.
+.TP
+.BR \-s ", " \-\^\-no-messages
 Suppress error messages about nonexistent or unreadable files.
+Portability note: unlike \s-1GNU\s0
+.BR grep ,
+traditional
+.B grep
+did not conform to \s-1POSIX.2\s0, because traditional
+.B grep
+lacked a
+.B \-q
+option and its
+.B \-s
+option behaved like \s-1GNU\s0
+.BR grep 's
+.B \-q
+option.
+Shell scripts intended to be portable to traditional
+.B grep
+should avoid both
+.B \-q
+and
+.B \-s
+and should redirect output to /dev/null instead.
 .TP
-.B \-v
+.BR \-a ", " \-\^\-text
+Do not suppress output lines that contain binary data.
+Normally, if the first few bytes of a file indicate that
+the file contains binary data,
+.B grep
+outputs only a message saying that the file matches the pattern.
+This option causes
+.B grep
+to act as if the file is a text file,
+even if it would otherwise be treated as binary.
+.TP
+.BR \-v ", " \-\^\-invert-match
 Invert the sense of matching, to select non-matching lines.
 .TP
-.B \-w
+.BR \-w ", " \-\^\-word-regexp
 Select only those lines containing matches that form whole words.
 The test is that the matching substring must either be at the
 beginning of the line, or preceded by a non-word constituent
@@ -162,44 +283,83 @@
 or followed by a non-word constituent character.  Word-constituent
 characters are letters, digits, and the underscore.
 .TP
-.B \-x
+.BR \-x ", " \-\^\-line-regexp
 Select only those matches that exactly match the whole line.
-
-.PP
-Following options are only available if compiled with FTS library:
-.PD 0
 .TP
-.BI \-H
-If the 
-.I \-R
-option is specified, symbolic links on the command line
-are followed.  (Symbolic links encountered in the tree traversal
-are not followed.)
-.TP
-.BI \-L
-If the 
-.I \-R
-option is specified, all symbolic links are followed.
-.TP
-.BI \-P
-If the 
-.I \-R
-option is specified, no symbolic links are followed.
-.TP
-.BI \-R
-Search in the file hierarchies
-rooted in the files instead of just the files themselves.
-
+.B \-y
+Obsolete synonym for
+.BR \-i .
+.TP
+.BR \-U ", " \-\^\-binary
+Treat the file(s) as binary.  By default, under MS-DOS and MS-Windows,
+.BR grep
+guesses the file type by looking at the contents of the first 32KB
+read from the file.  If
+.BR grep
+decides the file is a text file, it strips the CR characters from the
+original file contents (to make regular expressions with
+.B ^
+and
+.B $
+work correctly).  Specifying
+.B \-U
+overrules this guesswork, causing all files to be read and passed to the
+matching mechanism verbatim; if the file is a text file with CR/LF
+pairs at the end of each line, this will cause some regular
+expressions to fail.
+This option has no effect on platforms other than MS-DOS and
+MS-Windows.
+.TP
+.BR \-u ", " \-\^\-unix-byte-offsets
+Report Unix-style byte offsets.  This switch causes
+.B grep
+to report byte offsets as if the file were Unix-style text file, i.e. with
+CR characters stripped off.  This will produce results identical to running
+.B grep
+on a Unix machine.  This option has no effect unless
+.B \-b
+option is also used;
+it has no effect on platforms other than MS-DOS and MS-Windows.
+.TP
+.B \-\^\-mmap
+If possible, use the
+.BR mmap (2)
+system call to read input, instead of
+the default
+.BR read (2)
+system call.  In some situations,
+.B -\^-mmap
+yields better performance.  However,
+.B -\^-mmap
+can cause undefined behavior (including core dumps)
+if an input file shrinks while
+.B grep
+is operating, or if an I/O error occurs.
+.TP
+.BR \-Z ", " \-\^\-null
+Output a zero byte (the \s-1ASCII\s0
+.B NUL
+character) instead of the character that normally follows a file name.
+For example,
+.B "grep \-lZ"
+outputs a zero byte after each file name instead of the usual newline.
+This option makes the output unambiguous, even in the presence of file
+names containing unusual characters like newlines.  This option can be
+used with commands like
+.BR "find \-print0" ,
+.BR "perl \-0" ,
+.BR "sort \-z" ,
+and
+.B "xargs \-0"
+to process arbitrary file names,
+even those that contain newline characters.
+.PD
 .LP
-Following option is only available if compiled with zlib library:
+Following option is only available if compiled with zlib(3) library:
 .PD 0
 .TP
-.BI \-Z
-If the 
-.I \-Z
-option is specified, the input data will be
-decompressed before searching.
-.TP
+.B \-Z, --decompress
+Decompress the input data before searching.
 .PD
 .SH "REGULAR EXPRESSIONS"
 .PP
@@ -207,10 +367,10 @@
 Regular expressions are constructed analogously to arithmetic
 expressions, by using various operators to combine smaller expressions.
 .PP
-.B Grep
+.B grep
 understands two different versions of regular expression syntax:
-``basic'' and ``extended.''  In
-.RB "GNU\ " grep ,
+\*(lqbasic\*(rq and \*(lqextended.\*(rq  In
+.RB "\s-1GNU\s0\ " grep ,
 there is no difference in available functionality using either syntax.
 In other implementations, basic regular expressions are less powerful.
 The following description applies to extended regular expressions;
@@ -251,7 +411,7 @@
 .BR [:upper:] ,
 and
 .BR [:xdigit:].
-For example, 
+For example,
 .B [[:alnum:]]
 means
 .BR [0-9A-Za-z] ,
@@ -300,8 +460,7 @@
 .I not
 at the edge of a word.
 .PP
-A regular expression matching a single character may be followed
-by one of several repetition operators:
+A regular expression may be followed by one of several repetition operators:
 .PD 0
 .TP
 .B ?
@@ -323,11 +482,6 @@
 .I n
 or more times.
 .TP
-.BI {, m }
-The preceding item is optional and is matched at most
-.I m
-times.
-.TP
 .BI { n , m }
 The preceding item is matched at least
 .I n
@@ -377,12 +531,43 @@
 and
 .BR \e) .
 .PP
-In
+Traditional
+.B egrep
+did not support the
+.B {
+metacharacter, and some
+.B egrep
+implementations support
+.B \e{
+instead, so portable scripts should avoid
+.B {
+in
+.B egrep
+patterns and should use
+.B [{]
+to match a literal
+.BR { .
+.PP
+\s-1GNU\s0
 .B egrep
-the metacharacter
+attempts to support traditional usage by assuming that
 .B {
-loses its special meaning; instead use
-.BR \e{ .
+is not special if it would be the start of an invalid interval
+specification.  For example, the shell command
+.B "egrep '{1'"
+searches for the two-character string
+.B {1
+instead of reporting a syntax error in the regular expression.
+\s-1POSIX.2\s0 allows this behavior as an extension, but portable scripts
+should avoid it.
+.SH ENVIRONMENT
+The environment variable
+.B GREP_OPTIONS
+can hold a set of default
+options for
+.I grep.
+These options are interpreted first and can be overwritten by explicit command
+line parameters.
 .SH DIAGNOSTICS
 .PP
 Normally, exit status is 0 if matches were found,
@@ -395,8 +580,9 @@
 .SH BUGS
 .PP
 Email bug reports to
-.BR bug-gnu-utils@prep.ai.mit.edu .
-Be sure to include the word ``grep'' somewhere in the ``Subject:'' field.
+.BR bug-gnu-utils@gnu.org .
+Be sure to include the word \*(lqgrep\*(rq somewhere in the
+\*(lqSubject:\*(rq field.
 .PP
 Large repetition counts in the
 .BI { m , n }
@@ -408,3 +594,5 @@
 to run out of memory.
 .PP
 Backreferences are very slow, and may require exponential time.
+.\" Work around problems with some troff -man implementations.
+.br

--Multipart_Fri_Jan_28_11:02:01_2000-1--
