CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 16/04/22 05:25:56
Index: grep.html =================================================================== RCS file: /webcvs/grep/grep/manual/grep.html,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- grep.html 11 Mar 2016 06:09:07 -0000 1.23 +++ grep.html 22 Apr 2016 05:25:45 -0000 1.24 @@ -13,10 +13,10 @@ "GNU Free Documentation License". --> <!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ --> <head> -<title>GNU Grep 2.24</title> +<title>GNU Grep 2.25</title> -<meta name="description" content="GNU Grep 2.24"> -<meta name="keywords" content="GNU Grep 2.24"> +<meta name="description" content="GNU Grep 2.25"> +<meta name="keywords" content="GNU Grep 2.25"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> @@ -59,7 +59,7 @@ </head> <body lang="en"> -<h1 class="settitle" align="center">GNU Grep 2.24</h1> +<h1 class="settitle" align="center">GNU Grep 2.25</h1> @@ -123,7 +123,7 @@ <p><code>grep</code> prints lines that contain a match for a pattern. </p> -<p>This manual is for version 2.24 of GNU Grep. +<p>This manual is for version 2.25 of GNU Grep. </p> <p>This manual is for <code>grep</code>, a pattern matching engine. </p> @@ -303,8 +303,8 @@ <a name="index-_002d_002dregexp_003dpattern"></a> <a name="index-pattern-list"></a> <p>Use <var>pattern</var> as the pattern. -This can be used to specify multiple search patterns, -or to protect a pattern beginning with a ‘<samp>-</samp>’. +If this option is used multiple times or is combined with the +<samp>-f</samp> (<samp>--file</samp>) option, search for all patterns given. (<samp>-e</samp> is specified by POSIX.) </p> </dd> @@ -314,6 +314,8 @@ <a name="index-_002d_002dfile"></a> <a name="index-pattern-from-file"></a> <p>Obtain patterns from <var>file</var>, one per line. +If this option is used multiple times or is combined with the +<samp>-e</samp> (<samp>--regexp</samp>) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing. (<samp>-f</samp> is specified by POSIX.) </p> @@ -768,17 +770,13 @@ indicate that the file contains binary data, assume that the file is of type <var>type</var>. Non-text bytes indicate binary data; these are either output bytes that are -improperly encoded for the current locale, or null input bytes when the +improperly encoded for the current locale (see <a href="#Environment-Variables">Environment Variables</a>), or null input bytes when the <samp>-z</samp> (<samp>--null-data</samp>) option is not given (see <a href="#Other-Options">Other Options</a>). </p> <p>By default, <var>type</var> is ‘<samp>binary</samp>’, and when <code>grep</code> discovers that a file is binary it suppresses any further output, and instead outputs either a one-line message saying that a binary file matches, or no message if there is no match. -When processing binary data, <code>grep</code> may treat non-text bytes -as line terminators; for example, the pattern ‘<samp>.</samp>’ (period) might -not match a null byte, as the null byte might be treated as a line -terminator even without the <samp>-z</samp> (<samp>--null-data</samp>) option. </p> <p>If <var>type</var> is ‘<samp>without-match</samp>’, when <code>grep</code> discovers that a file is binary @@ -789,10 +787,23 @@ <code>grep</code> processes a binary file as if it were text; this is equivalent to the <samp>-a</samp> option. </p> -<p><em>Warning:</em> ‘<samp>--binary-files=text</samp>’ might output binary garbage, -which can have nasty side effects -if the output is a terminal and -if the terminal driver interprets some of it as commands. +<p>When <var>type</var> is ‘<samp>binary</samp>’, <code>grep</code> may treat non-text +bytes as line terminators even without the <samp>-z</samp> +(<samp>--null-data</samp>) option. This means choosing ‘<samp>binary</samp>’ +versus ‘<samp>text</samp>’ can affect whether a pattern matches a file. For +example, when <var>type</var> is ‘<samp>binary</samp>’ the pattern ‘<samp>q$</samp>’ might +match ‘<samp>q</samp>’ immediately followed by a null byte, even though this +is not matched when <var>type</var> is ‘<samp>text</samp>’. Conversely, when +<var>type</var> is ‘<samp>binary</samp>’ the pattern ‘<samp>.</samp>’ (period) might not +match a null byte. +</p> +<p><em>Warning:</em> The <samp>-a</samp> (<samp>--binary-files=text</samp>) option +might output binary garbage, which can have nasty side effects if the +output is a terminal and if the terminal driver interprets some of it +as commands. On the other hand, when reading files whose text +encodings are unknown, it can be helpful to use <samp>-a</samp> or to set +‘<samp>LC_ALL='C'</samp>’ in the environment, in order to find more matches +even if the matches are unsafe for direct display. </p> </dd> <dt><samp>-D <var>action</var></samp></dt> @@ -947,8 +958,8 @@ <dd><a name="index-_002dz"></a> <a name="index-_002d_002dnull_002ddata"></a> <a name="index-zero_002dterminated-lines"></a> -<p>Treat the input as a set of lines, each terminated by a zero byte (the -ASCII NUL character) instead of a newline. +<p>Treat input and output data as sequences of lines, each terminated by +a zero byte (the ASCII NUL character) instead of a newline. Like the <samp>-Z</samp> or <samp>--null</samp> option, this option can be used with commands like ‘<samp>sort -z</samp>’ to process arbitrary file names. @@ -989,6 +1000,7 @@ if the locale catalog is not installed, or if <code>grep</code> was not compiled with national language support (NLS). +The shell command <code>locale -a</code> lists locales that are currently available. </p> <p>Many of the environment variables in the following list let you control highlighting using @@ -1204,6 +1216,10 @@ <p>These variables specify the locale for the <code>LC_CTYPE</code> category, which determines the type of characters, e.g., which characters are whitespace. +This category also determines the character encoding, that is, whether +text is encoded in UTF-8, ASCII, or some other encoding. In the +‘<samp>C</samp>’ or ‘<samp>POSIX</samp>’ locale, all characters are encoded as a +single byte and every byte is a valid character. </p> </dd> <dt><code>LANGUAGE</code></dt> @@ -1325,8 +1341,8 @@ <dt><samp>--perl-regexp</samp></dt> <dd><a name="index-_002dP"></a> <a name="index-_002d_002dperl_002dregexp"></a> -<a name="index-matching-Perl-regular-expressions"></a> -<p>Interpret the pattern as a Perl regular expression. +<a name="index-matching-Perl_002dcompatible-regular-expressions"></a> +<p>Interpret the pattern as a Perl-compatible regular expression (PCRE). This is highly experimental and ‘<samp>grep -P</samp>’ may warn of unimplemented features. </p> @@ -1358,16 +1374,16 @@ by using various operators to combine smaller expressions. <code>grep</code> understands three different versions of regular expression syntax: -“basic,” (BRE) “extended” (ERE) and “perl”. +“basic” (BRE), “extended” (ERE) and “perl” (PCRE). In GNU <code>grep</code>, there is no difference in available functionality between the basic and extended syntaxes. In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. -Perl regular expressions give additional functionality, and are -documented in the <i>pcresyntax</i>(3) and <i>pcrepattern</i>(3) manual pages, -but work only if PCRE is available in the system. +Perl-compatible regular expressions give additional functionality, and +are documented in the <i>pcresyntax</i>(3) and <i>pcrepattern</i>(3) manual +pages, but work only if PCRE is available in the system. </p> <table class="menu" border="0" cellspacing="0"> <tr><td align="left" valign="top">• <a href="#Fundamental-Structure" accesskey="1">Fundamental Structure</a>:</td><td> </td><td align="left" valign="top"> @@ -2911,7 +2927,7 @@ <tr><td></td><td valign="top"><a href="#index-matching-basic-regular-expressions">matching basic regular expressions</a>:</td><td> </td><td valign="top"><a href="#grep-Programs">grep Programs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-matching-extended-regular-expressions">matching extended regular expressions</a>:</td><td> </td><td valign="top"><a href="#grep-Programs">grep Programs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-matching-fixed-strings">matching fixed strings</a>:</td><td> </td><td valign="top"><a href="#grep-Programs">grep Programs</a></td></tr> -<tr><td></td><td valign="top"><a href="#index-matching-Perl-regular-expressions">matching Perl regular expressions</a>:</td><td> </td><td valign="top"><a href="#grep-Programs">grep Programs</a></td></tr> +<tr><td></td><td valign="top"><a href="#index-matching-Perl_002dcompatible-regular-expressions">matching Perl-compatible regular expressions</a>:</td><td> </td><td valign="top"><a href="#grep-Programs">grep Programs</a></td></tr> <tr><td></td><td valign="top"><a href="#index-matching-whole-words">matching whole words</a>:</td><td> </td><td valign="top"><a href="#Matching-Control">Matching Control</a></td></tr> <tr><td></td><td valign="top"><a href="#index-max_002dcount">max-count</a>:</td><td> </td><td valign="top"><a href="#General-Output-Control">General Output Control</a></td></tr> <tr><td></td><td valign="top"><a href="#index-mc-GREP_005fCOLORS-capability"><code>mc GREP_COLORS <span class="roman">capability</span></code></a>:</td><td> </td><td valign="top"><a href="#Environment-Variables">Environment Variables</a></td></tr>
