CVSROOT:        /webcvs/grep
Module name:    grep
Changes by:     Jim Meyering <meyering> 25/04/11 13:06:09

Index: grep.html
===================================================================
RCS file: /webcvs/grep/grep/manual/grep.html,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- grep.html   13 May 2023 09:23:47 -0000      1.35
+++ grep.html   11 Apr 2025 17:06:04 -0000      1.36
@@ -1,11 +1,11 @@
 <!DOCTYPE html>
 <html>
-<!-- Created by GNU Texinfo 7.0dev, https://www.gnu.org/software/texinfo/ -->
+<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <!-- This manual is for grep, a pattern matching engine.
 
-Copyright © 1999-2002, 2005, 2008-2023 Free Software Foundation,
+Copyright © 1999-2002, 2005, 2008-2025 Free Software Foundation,
 Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -14,10 +14,10 @@
 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
 Texts.  A copy of the license is included in the section entitled
 "GNU Free Documentation License". -->
-<title>GNU Grep 3.11</title>
+<title>GNU Grep 3.12</title>
 
-<meta name="description" content="GNU Grep 3.11">
-<meta name="keywords" content="GNU Grep 3.11">
+<meta name="description" content="GNU Grep 3.12">
+<meta name="keywords" content="GNU Grep 3.12">
 <meta name="resource-type" content="document">
 <meta name="distribution" content="global">
 <meta name="Generator" content="makeinfo">
@@ -69,11 +69,11 @@
 
 <p><code class="command">grep</code> prints lines that contain a match for one 
or more patterns.
 </p>
-<p>This manual is for version 3.11 of GNU Grep.
+<p>This manual is for version 3.12 of GNU Grep.
 </p>
 <p>This manual is for <code class="command">grep</code>, a pattern matching 
engine.
 </p>
-<p>Copyright &copy; 1999&ndash;2002, 2005, 2008&ndash;2023 Free Software 
Foundation,
+<p>Copyright &copy; 1999&ndash;2002, 2005, 2008&ndash;2025 Free Software 
Foundation,
 Inc.
 </p>
 <blockquote class="quotation">
@@ -173,7 +173,7 @@
 <p>The general synopsis of the <code class="command">grep</code> command line 
is
 </p>
 <div class="example">
-<pre class="example-preformatted">grep [<var class="var">option</var>...] 
[<var class="var">patterns</var>] [<var class="var">file</var>...]
+<pre class="example-preformatted">grep [<var class="var">option</var>]... 
[<var class="var">patterns</var>] [<var class="var">file</var>]...
 </pre></div>
 
 <p>There can be zero or more <var class="var">option</var> arguments, and zero 
or more
@@ -232,19 +232,17 @@
 <h4 class="subsection" id="Generic-Program-Information-1"><span>2.1.1 Generic 
Program Information<a class="copiable-link" 
href="#Generic-Program-Information-1"> &para;</a></span></h4>
 
 <dl class="table">
-<dt><samp class="option">--help</samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dhelp"></a>
-<a class="index-entry-id" id="index-usage-summary_002c-printing"></a>
-<p>Print a usage message briefly summarizing the command-line options
+<dt><a class="index-entry-id" id="index-usage-summary_002c-printing"></a>
+<a id="index-_002d_002dhelp"></a><span><samp class="option">--help</samp><a 
class="copiable-link" href="#index-_002d_002dhelp"> &para;</a></span></dt>
+<dd><p>Print a usage message briefly summarizing the command-line options
 and the bug-reporting address, then exit.
 </p>
 </dd>
-<dt><samp class="option">-V</samp></dt>
-<dt><samp class="option">--version</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dV"></a>
-<a class="index-entry-id" id="index-_002d_002dversion"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dversion"></a>
 <a class="index-entry-id" id="index-version_002c-printing"></a>
-<p>Print the version number of <code class="command">grep</code> to the 
standard output stream.
+<a id="index-_002dV"></a><span><samp class="option">-V</samp><a 
class="copiable-link" href="#index-_002dV"> &para;</a></span></dt>
+<dt><samp class="option">--version</samp></dt>
+<dd><p>Print the version number of <code class="command">grep</code> to the 
standard output stream.
 This version number should be included in all bug reports.
 </p>
 </dd>
@@ -260,12 +258,11 @@
 <h4 class="subsection" id="Matching-Control-1"><span>2.1.2 Matching Control<a 
class="copiable-link" href="#Matching-Control-1"> &para;</a></span></h4>
 
 <dl class="table">
-<dt><samp class="option">-e <var class="var">patterns</var></samp></dt>
-<dt><samp class="option">--regexp=<var class="var">patterns</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002de"></a>
-<a class="index-entry-id" id="index-_002d_002dregexp_003dpatterns"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dregexp_003dpatterns"></a>
 <a class="index-entry-id" id="index-patterns-option"></a>
-<p>Use <var class="var">patterns</var> as one or more patterns; newlines within
+<a id="index-_002de"></a><span><samp class="option">-e <var 
class="var">patterns</var></samp><a class="copiable-link" href="#index-_002de"> 
&para;</a></span></dt>
+<dt><samp class="option">--regexp=<var class="var">patterns</var></samp></dt>
+<dd><p>Use <var class="var">patterns</var> as one or more patterns; newlines 
within
 <var class="var">patterns</var> separate each pattern from the next.
 If this option is used multiple times or is combined with the
 <samp class="option">-f</samp> (<samp class="option">--file</samp>) option, 
search for all patterns given.
@@ -274,12 +271,11 @@
 (<samp class="option">-e</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-f <var class="var">file</var></samp></dt>
-<dt><samp class="option">--file=<var class="var">file</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002df"></a>
-<a class="index-entry-id" id="index-_002d_002dfile"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dfile"></a>
 <a class="index-entry-id" id="index-patterns-from-file"></a>
-<p>Obtain patterns from <var class="var">file</var>, one per line.
+<a id="index-_002df"></a><span><samp class="option">-f <var 
class="var">file</var></samp><a class="copiable-link" href="#index-_002df"> 
&para;</a></span></dt>
+<dt><samp class="option">--file=<var class="var">file</var></samp></dt>
+<dd><p>Obtain patterns from <var class="var">file</var>, one per line.
 If this option is used multiple times or is combined with the
 <samp class="option">-e</samp> (<samp class="option">--regexp</samp>) option, 
search for all patterns given.
 When <var class="var">file</var> is &lsquo;<samp class="samp">-</samp>&rsquo;, 
read patterns from standard input.
@@ -287,57 +283,55 @@
 (<samp class="option">-f</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-i</samp></dt>
-<dt><samp class="option">-y</samp></dt>
-<dt><samp class="option">--ignore-case</samp></dt>
-<dd><a class="index-entry-id" id="index-_002di"></a>
-<a class="index-entry-id" id="index-_002dy"></a>
+<dt><a class="index-entry-id" id="index-_002dy"></a>
 <a class="index-entry-id" id="index-_002d_002dignore_002dcase"></a>
 <a class="index-entry-id" id="index-case-insensitive-search"></a>
-<p>Ignore case distinctions in patterns and input data,
+<a id="index-_002di"></a><span><samp class="option">-i</samp><a 
class="copiable-link" href="#index-_002di"> &para;</a></span></dt>
+<dt><samp class="option">-y</samp></dt>
+<dt><samp class="option">--ignore-case</samp></dt>
+<dd><p>Ignore case distinctions in patterns and input data,
 so that characters that differ only in case
 match each other.  Although this is straightforward when letters
 differ in case only via lowercase-uppercase pairs, the behavior is
 unspecified in other situations.  For example, uppercase &ldquo;S&rdquo; has an
-unusual lowercase counterpart &ldquo;Å¿&rdquo; (Unicode character U+017F, LATIN
+unusual lowercase counterpart
+&ldquo;Å¿&rdquo;
+(Unicode character U+017F LATIN
 SMALL LETTER LONG S) in many locales, and it is unspecified whether
 this unusual character matches &ldquo;S&rdquo; or &ldquo;s&rdquo; even though 
uppercasing
 it yields &ldquo;S&rdquo;.  Another example: the lowercase German letter 
&ldquo;ß&rdquo;
-(U+00DF, LATIN SMALL LETTER SHARP S) is normally capitalized as the
+(U+00DF LATIN SMALL LETTER SHARP S) is normally capitalized as the
 two-character string &ldquo;SS&rdquo; but it does not match &ldquo;SS&rdquo;, 
and it might
 not match the uppercase letter
 &ldquo;ẞ&rdquo;
-(U+1E9E, LATIN CAPITAL LETTER
+(U+1E9E LATIN CAPITAL LETTER
 SHARP S) even though lowercasing the latter yields the former.
 </p>
 <p><samp class="option">-y</samp> is an obsolete synonym that is provided for 
compatibility.
 (<samp class="option">-i</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">--no-ignore-case</samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dno_002dignore_002dcase"></a>
-<p>Do not ignore case distinctions in patterns and input data.  This is
+<dt><a id="index-_002d_002dno_002dignore_002dcase"></a><span><samp 
class="option">--no-ignore-case</samp><a class="copiable-link" 
href="#index-_002d_002dno_002dignore_002dcase"> &para;</a></span></dt>
+<dd><p>Do not ignore case distinctions in patterns and input data.  This is
 the default.  This option is useful for passing to shell scripts that
 already use <samp class="option">-i</samp>, in order to cancel its effects 
because the
 two options override each other.
 </p>
 </dd>
-<dt><samp class="option">-v</samp></dt>
-<dt><samp class="option">--invert-match</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dv"></a>
-<a class="index-entry-id" id="index-_002d_002dinvert_002dmatch"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dinvert_002dmatch"></a>
 <a class="index-entry-id" id="index-invert-matching"></a>
 <a class="index-entry-id" id="index-print-non_002dmatching-lines"></a>
-<p>Invert the sense of matching, to select non-matching lines.
+<a id="index-_002dv"></a><span><samp class="option">-v</samp><a 
class="copiable-link" href="#index-_002dv"> &para;</a></span></dt>
+<dt><samp class="option">--invert-match</samp></dt>
+<dd><p>Invert the sense of matching, to select non-matching lines.
 (<samp class="option">-v</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-w</samp></dt>
-<dt><samp class="option">--word-regexp</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dw"></a>
-<a class="index-entry-id" id="index-_002d_002dword_002dregexp"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dword_002dregexp"></a>
 <a class="index-entry-id" id="index-matching-whole-words"></a>
-<p>Select only those lines containing matches that form whole words.
+<a id="index-_002dw"></a><span><samp class="option">-w</samp><a 
class="copiable-link" href="#index-_002dw"> &para;</a></span></dt>
+<dt><samp class="option">--word-regexp</samp></dt>
+<dd><p>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 character.
@@ -355,12 +349,11 @@
 word constituent.  See <a class="xref" 
href="#Special-Backslash-Expressions">Special Backslash Expressions</a>.
 </p>
 </dd>
-<dt><samp class="option">-x</samp></dt>
-<dt><samp class="option">--line-regexp</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dx"></a>
-<a class="index-entry-id" id="index-_002d_002dline_002dregexp"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dline_002dregexp"></a>
 <a class="index-entry-id" id="index-match-the-whole-line"></a>
-<p>Select only those matches that exactly match the whole line.
+<a id="index-_002dx"></a><span><samp class="option">-x</samp><a 
class="copiable-link" href="#index-_002dx"> &para;</a></span></dt>
+<dt><samp class="option">--line-regexp</samp></dt>
+<dd><p>Select only those matches that exactly match the whole line.
 For regular expression patterns, this is like parenthesizing each
 pattern and then surrounding it with &lsquo;<samp class="samp">^</samp>&rsquo; 
and &lsquo;<samp class="samp">$</samp>&rsquo;.
 (<samp class="option">-x</samp> is specified by POSIX.)
@@ -378,24 +371,22 @@
 <h4 class="subsection" id="General-Output-Control-1"><span>2.1.3 General 
Output Control<a class="copiable-link" href="#General-Output-Control-1"> 
&para;</a></span></h4>
 
 <dl class="table">
-<dt><samp class="option">-c</samp></dt>
-<dt><samp class="option">--count</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dc"></a>
-<a class="index-entry-id" id="index-_002d_002dcount"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dcount"></a>
 <a class="index-entry-id" id="index-counting-lines"></a>
-<p>Suppress normal output;
+<a id="index-_002dc"></a><span><samp class="option">-c</samp><a 
class="copiable-link" href="#index-_002dc"> &para;</a></span></dt>
+<dt><samp class="option">--count</samp></dt>
+<dd><p>Suppress normal output;
 instead print a count of matching lines for each input file.
 With the <samp class="option">-v</samp> (<samp 
class="option">--invert-match</samp>) option,
 count non-matching lines.
 (<samp class="option">-c</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">--color[=<var class="var">WHEN</var>]</samp></dt>
-<dt><samp class="option">--colour[=<var class="var">WHEN</var>]</samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dcolor"></a>
-<a class="index-entry-id" id="index-_002d_002dcolour"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dcolour"></a>
 <a class="index-entry-id" id="index-highlight_002c-color_002c-colour"></a>
-<p>Surround matched non-empty strings, matching lines, context lines,
+<a id="index-_002d_002dcolor"></a><span><samp class="option">--color[=<var 
class="var">WHEN</var>]</samp><a class="copiable-link" 
href="#index-_002d_002dcolor"> &para;</a></span></dt>
+<dt><samp class="option">--colour[=<var class="var">WHEN</var>]</samp></dt>
+<dd><p>Surround matched non-empty strings, matching lines, context lines,
 file names, line numbers, byte offsets, and separators (for fields and
 groups of context lines) with escape sequences to display them in color
 on the terminal.
@@ -413,34 +404,31 @@
 if no <samp class="option">--color</samp> option is given, the default is 
<samp class="option">--color=never</samp>.
 </p>
 </dd>
-<dt><samp class="option">-L</samp></dt>
-<dt><samp class="option">--files-without-match</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dL"></a>
-<a class="index-entry-id" id="index-_002d_002dfiles_002dwithout_002dmatch"></a>
+<dt><a class="index-entry-id" 
id="index-_002d_002dfiles_002dwithout_002dmatch"></a>
 <a class="index-entry-id" id="index-files-which-don_0027t-match"></a>
-<p>Suppress normal output;
+<a id="index-_002dL"></a><span><samp class="option">-L</samp><a 
class="copiable-link" href="#index-_002dL"> &para;</a></span></dt>
+<dt><samp class="option">--files-without-match</samp></dt>
+<dd><p>Suppress normal output;
 instead print the name of each input file from which
 no output would normally have been printed.
 </p>
 </dd>
-<dt><samp class="option">-l</samp></dt>
-<dt><samp class="option">--files-with-matches</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dl"></a>
-<a class="index-entry-id" id="index-_002d_002dfiles_002dwith_002dmatches"></a>
+<dt><a class="index-entry-id" 
id="index-_002d_002dfiles_002dwith_002dmatches"></a>
 <a class="index-entry-id" id="index-names-of-matching-files"></a>
-<p>Suppress normal output;
+<a id="index-_002dl"></a><span><samp class="option">-l</samp><a 
class="copiable-link" href="#index-_002dl"> &para;</a></span></dt>
+<dt><samp class="option">--files-with-matches</samp></dt>
+<dd><p>Suppress normal output;
 instead print the name of each input file from which
 output would normally have been printed.
 Scanning each input file stops upon first match.
 (<samp class="option">-l</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-m <var class="var">num</var></samp></dt>
-<dt><samp class="option">--max-count=<var class="var">num</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002dm"></a>
-<a class="index-entry-id" id="index-_002d_002dmax_002dcount"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dmax_002dcount"></a>
 <a class="index-entry-id" id="index-max_002dcount"></a>
-<p>Stop after the first <var class="var">num</var> selected lines.
+<a id="index-_002dm"></a><span><samp class="option">-m <var 
class="var">num</var></samp><a class="copiable-link" href="#index-_002dm"> 
&para;</a></span></dt>
+<dt><samp class="option">--max-count=<var class="var">num</var></samp></dt>
+<dd><p>Stop after the first <var class="var">num</var> selected lines.
 If <var class="var">num</var> is zero, <code class="command">grep</code> stops 
right away without reading input.
 A <var class="var">num</var> of &minus;1 is treated as infinity and <code 
class="command">grep</code>
 does not stop; this is the default.
@@ -481,25 +469,23 @@
 <code class="command">grep</code> stops after outputting <var 
class="var">num</var> non-matching lines.
 </p>
 </dd>
-<dt><samp class="option">-o</samp></dt>
-<dt><samp class="option">--only-matching</samp></dt>
-<dd><a class="index-entry-id" id="index-_002do"></a>
-<a class="index-entry-id" id="index-_002d_002donly_002dmatching"></a>
+<dt><a class="index-entry-id" id="index-_002d_002donly_002dmatching"></a>
 <a class="index-entry-id" id="index-only-matching"></a>
-<p>Print only the matched non-empty parts of matching lines,
+<a id="index-_002do"></a><span><samp class="option">-o</samp><a 
class="copiable-link" href="#index-_002do"> &para;</a></span></dt>
+<dt><samp class="option">--only-matching</samp></dt>
+<dd><p>Print only the matched non-empty parts of matching lines,
 with each such part on a separate output line.
 Output lines use the same delimiters as input, and delimiters are null
 bytes if <samp class="option">-z</samp> (<samp 
class="option">--null-data</samp>) is also used (see <a class="pxref" 
href="#Other-Options">Other Options</a>).
 </p>
 </dd>
-<dt><samp class="option">-q</samp></dt>
-<dt><samp class="option">--quiet</samp></dt>
-<dt><samp class="option">--silent</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dq"></a>
-<a class="index-entry-id" id="index-_002d_002dquiet"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dquiet"></a>
 <a class="index-entry-id" id="index-_002d_002dsilent"></a>
 <a class="index-entry-id" id="index-quiet_002c-silent"></a>
-<p>Quiet; do not write anything to standard output.
+<a id="index-_002dq"></a><span><samp class="option">-q</samp><a 
class="copiable-link" href="#index-_002dq"> &para;</a></span></dt>
+<dt><samp class="option">--quiet</samp></dt>
+<dt><samp class="option">--silent</samp></dt>
+<dd><p>Quiet; do not write anything to standard output.
 Exit immediately with zero status if any match is found,
 even if an error was detected.
 Also see the <samp class="option">-s</samp> or <samp 
class="option">--no-messages</samp> option.
@@ -509,12 +495,11 @@
 (<samp class="option">-q</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-s</samp></dt>
-<dt><samp class="option">--no-messages</samp></dt>
-<dd><a class="index-entry-id" id="index-_002ds"></a>
-<a class="index-entry-id" id="index-_002d_002dno_002dmessages"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dno_002dmessages"></a>
 <a class="index-entry-id" id="index-suppress-error-messages"></a>
-<p>Suppress error messages about nonexistent or unreadable files.
+<a id="index-_002ds"></a><span><samp class="option">-s</samp><a 
class="copiable-link" href="#index-_002ds"> &para;</a></span></dt>
+<dt><samp class="option">--no-messages</samp></dt>
+<dd><p>Suppress error messages about nonexistent or unreadable files.
 (<samp class="option">-s</samp> is specified by POSIX.)
 </p>
 </dd>
@@ -534,40 +519,36 @@
 regardless of the order in which these options were specified.
 </p>
 <dl class="table">
-<dt><samp class="option">-b</samp></dt>
-<dt><samp class="option">--byte-offset</samp></dt>
-<dd><a class="index-entry-id" id="index-_002db"></a>
-<a class="index-entry-id" id="index-_002d_002dbyte_002doffset"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dbyte_002doffset"></a>
 <a class="index-entry-id" id="index-byte-offset"></a>
-<p>Print the 0-based byte offset within the input file
+<a id="index-_002db"></a><span><samp class="option">-b</samp><a 
class="copiable-link" href="#index-_002db"> &para;</a></span></dt>
+<dt><samp class="option">--byte-offset</samp></dt>
+<dd><p>Print the 0-based byte offset within the input file
 before each line of output.
 If <samp class="option">-o</samp> (<samp 
class="option">--only-matching</samp>) is specified,
 print the offset of the matching part itself.
 </p>
 </dd>
-<dt><samp class="option">-H</samp></dt>
-<dt><samp class="option">--with-filename</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dH"></a>
-<a class="index-entry-id" id="index-_002d_002dwith_002dfilename"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dwith_002dfilename"></a>
 <a class="index-entry-id" id="index-with-filename-prefix"></a>
-<p>Print the file name for each match.
+<a id="index-_002dH"></a><span><samp class="option">-H</samp><a 
class="copiable-link" href="#index-_002dH"> &para;</a></span></dt>
+<dt><samp class="option">--with-filename</samp></dt>
+<dd><p>Print the file name for each match.
 This is the default when there is more than one file to search.
 </p>
 </dd>
-<dt><samp class="option">-h</samp></dt>
-<dt><samp class="option">--no-filename</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dh"></a>
-<a class="index-entry-id" id="index-_002d_002dno_002dfilename"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dno_002dfilename"></a>
 <a class="index-entry-id" id="index-no-filename-prefix"></a>
-<p>Suppress the prefixing of file names on output.
+<a id="index-_002dh"></a><span><samp class="option">-h</samp><a 
class="copiable-link" href="#index-_002dh"> &para;</a></span></dt>
+<dt><samp class="option">--no-filename</samp></dt>
+<dd><p>Suppress the prefixing of file names on output.
 This is the default when there is only one file
 (or only standard input) to search.
 </p>
 </dd>
-<dt><samp class="option">--label=<var class="var">LABEL</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dlabel"></a>
-<a class="index-entry-id" id="index-changing-name-of-standard-input"></a>
-<p>Display input actually coming from standard input
+<dt><a class="index-entry-id" id="index-changing-name-of-standard-input"></a>
+<a id="index-_002d_002dlabel"></a><span><samp class="option">--label=<var 
class="var">LABEL</var></samp><a class="copiable-link" 
href="#index-_002d_002dlabel"> &para;</a></span></dt>
+<dd><p>Display input actually coming from standard input
 as input coming from file <var class="var">LABEL</var>.
 This can be useful for commands that transform a file&rsquo;s contents
 before searching; e.g.:
@@ -577,21 +558,19 @@
 </pre></div>
 
 </dd>
-<dt><samp class="option">-n</samp></dt>
-<dt><samp class="option">--line-number</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dn"></a>
-<a class="index-entry-id" id="index-_002d_002dline_002dnumber"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dline_002dnumber"></a>
 <a class="index-entry-id" id="index-line-numbering"></a>
-<p>Prefix each line of output with the 1-based line number within its input 
file.
+<a id="index-_002dn"></a><span><samp class="option">-n</samp><a 
class="copiable-link" href="#index-_002dn"> &para;</a></span></dt>
+<dt><samp class="option">--line-number</samp></dt>
+<dd><p>Prefix each line of output with the 1-based line number within its 
input file.
 (<samp class="option">-n</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-T</samp></dt>
-<dt><samp class="option">--initial-tab</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dT"></a>
-<a class="index-entry-id" id="index-_002d_002dinitial_002dtab"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dinitial_002dtab"></a>
 <a class="index-entry-id" id="index-tab_002daligned-content-lines"></a>
-<p>Make sure that the first character of actual line content lies on a tab 
stop,
+<a id="index-_002dT"></a><span><samp class="option">-T</samp><a 
class="copiable-link" href="#index-_002dT"> &para;</a></span></dt>
+<dt><samp class="option">--initial-tab</samp></dt>
+<dd><p>Make sure that the first character of actual line content lies on a tab 
stop,
 so that the alignment of tabs looks normal.
 This is useful with options that prefix their output to the actual content:
 <samp class="option">-H</samp>, <samp class="option">-n</samp>, and <samp 
class="option">-b</samp>.
@@ -599,12 +578,11 @@
 so that lines from a single file all start at the same column.
 </p>
 </dd>
-<dt><samp class="option">-Z</samp></dt>
-<dt><samp class="option">--null</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dZ"></a>
-<a class="index-entry-id" id="index-_002d_002dnull"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dnull"></a>
 <a class="index-entry-id" id="index-zero_002dterminated-file-names"></a>
-<p>Output a zero byte (the ASCII NUL character)
+<a id="index-_002dZ"></a><span><samp class="option">-Z</samp><a 
class="copiable-link" href="#index-_002dZ"> &para;</a></span></dt>
+<dt><samp class="option">--null</samp></dt>
+<dd><p>Output a zero byte (the ASCII NUL character)
 instead of the character that normally follows a file name.
 For example,
 &lsquo;<samp class="samp">grep -lZ</samp>&rsquo; outputs a zero byte after 
each file name
@@ -637,45 +615,40 @@
 these options have no effect and a warning is given upon their use.
 </p>
 <dl class="table">
-<dt><samp class="option">-A <var class="var">num</var></samp></dt>
-<dt><samp class="option">--after-context=<var class="var">num</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002dA"></a>
-<a class="index-entry-id" id="index-_002d_002dafter_002dcontext"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dafter_002dcontext"></a>
 <a class="index-entry-id" id="index-after-context"></a>
 <a class="index-entry-id" id="index-context-lines_002c-after-match"></a>
-<p>Print <var class="var">num</var> lines of trailing context after matching 
lines.
+<a id="index-_002dA"></a><span><samp class="option">-A <var 
class="var">num</var></samp><a class="copiable-link" href="#index-_002dA"> 
&para;</a></span></dt>
+<dt><samp class="option">--after-context=<var class="var">num</var></samp></dt>
+<dd><p>Print <var class="var">num</var> lines of trailing context after 
matching lines.
 </p>
 </dd>
-<dt><samp class="option">-B <var class="var">num</var></samp></dt>
-<dt><samp class="option">--before-context=<var 
class="var">num</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002dB"></a>
-<a class="index-entry-id" id="index-_002d_002dbefore_002dcontext"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dbefore_002dcontext"></a>
 <a class="index-entry-id" id="index-before-context"></a>
 <a class="index-entry-id" id="index-context-lines_002c-before-match"></a>
-<p>Print <var class="var">num</var> lines of leading context before matching 
lines.
+<a id="index-_002dB"></a><span><samp class="option">-B <var 
class="var">num</var></samp><a class="copiable-link" href="#index-_002dB"> 
&para;</a></span></dt>
+<dt><samp class="option">--before-context=<var 
class="var">num</var></samp></dt>
+<dd><p>Print <var class="var">num</var> lines of leading context before 
matching lines.
 </p>
 </dd>
-<dt><samp class="option">-C <var class="var">num</var></samp></dt>
-<dt><samp class="option">-<var class="var">num</var></samp></dt>
-<dt><samp class="option">--context=<var class="var">num</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002dC"></a>
-<a class="index-entry-id" id="index-_002d_002dcontext"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dcontext"></a>
 <a class="index-entry-id" id="index-_002dnum"></a>
 <a class="index-entry-id" id="index-context-lines-2"></a>
-<p>Print <var class="var">num</var> lines of leading and trailing output 
context.
+<a id="index-_002dC"></a><span><samp class="option">-C <var 
class="var">num</var></samp><a class="copiable-link" href="#index-_002dC"> 
&para;</a></span></dt>
+<dt><samp class="option">-<var class="var">num</var></samp></dt>
+<dt><samp class="option">--context=<var class="var">num</var></samp></dt>
+<dd><p>Print <var class="var">num</var> lines of leading and trailing output 
context.
 </p>
 </dd>
-<dt><samp class="option">--group-separator=<var 
class="var">string</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dgroup_002dseparator"></a>
-<a class="index-entry-id" id="index-group-separator"></a>
-<p>When <samp class="option">-A</samp>, <samp class="option">-B</samp> or 
<samp class="option">-C</samp> are in use,
-print <var class="var">string</var> instead of <samp class="option">--</samp> 
between groups of lines.
+<dt><a class="index-entry-id" id="index-group-separator"></a>
+<a id="index-_002d_002dgroup_002dseparator"></a><span><samp 
class="option">--group-separator=<var class="var">string</var></samp><a 
class="copiable-link" href="#index-_002d_002dgroup_002dseparator"> 
&para;</a></span></dt>
+<dd><p>When <samp class="option">-A</samp>, <samp class="option">-B</samp> or 
<samp class="option">-C</samp> are in use,
+print <var class="var">string</var> instead of &lsquo;<samp 
class="samp">--</samp>&rsquo; between groups of lines.
 </p>
 </dd>
-<dt><samp class="option">--no-group-separator</samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dgroup_002dseparator-1"></a>
-<a class="index-entry-id" id="index-group-separator-1"></a>
-<p>When <samp class="option">-A</samp>, <samp class="option">-B</samp> or 
<samp class="option">-C</samp> are in use,
+<dt><a class="index-entry-id" id="index-group-separator-1"></a>
+<a id="index-_002d_002dgroup_002dseparator-1"></a><span><samp 
class="option">--no-group-separator</samp><a class="copiable-link" 
href="#index-_002d_002dgroup_002dseparator-1"> &para;</a></span></dt>
+<dd><p>When <samp class="option">-A</samp>, <samp class="option">-B</samp> or 
<samp class="option">-C</samp> are in use,
 do not print a separator between groups of lines.
 </p>
 </dd>
@@ -718,20 +691,18 @@
 <h4 class="subsection" id="File-and-Directory-Selection-1"><span>2.1.6 File 
and Directory Selection<a class="copiable-link" 
href="#File-and-Directory-Selection-1"> &para;</a></span></h4>
 
 <dl class="table">
-<dt><samp class="option">-a</samp></dt>
-<dt><samp class="option">--text</samp></dt>
-<dd><a class="index-entry-id" id="index-_002da"></a>
-<a class="index-entry-id" id="index-_002d_002dtext"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dtext"></a>
 <a class="index-entry-id" id="index-suppress-binary-data"></a>
 <a class="index-entry-id" id="index-binary-files"></a>
-<p>Process a binary file as if it were text;
+<a id="index-_002da"></a><span><samp class="option">-a</samp><a 
class="copiable-link" href="#index-_002da"> &para;</a></span></dt>
+<dt><samp class="option">--text</samp></dt>
+<dd><p>Process a binary file as if it were text;
 this is equivalent to the &lsquo;<samp 
class="samp">--binary-files=text</samp>&rsquo; option.
 </p>
 </dd>
-<dt><samp class="option">--binary-files=<var class="var">type</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dbinary_002dfiles"></a>
-<a class="index-entry-id" id="index-binary-files-1"></a>
-<p>If a file&rsquo;s data or metadata
+<dt><a class="index-entry-id" id="index-binary-files-1"></a>
+<a id="index-_002d_002dbinary_002dfiles"></a><span><samp 
class="option">--binary-files=<var class="var">type</var></samp><a 
class="copiable-link" href="#index-_002d_002dbinary_002dfiles"> 
&para;</a></span></dt>
+<dd><p>If a file&rsquo;s data or metadata
 indicate that the file contains binary data,
 assume that the file is of type <var class="var">type</var>.
 Non-text bytes indicate binary data; these are either output bytes that are
@@ -745,9 +716,11 @@
 with a message to standard error saying that a binary file matches.
 </p>
 <p>If <var class="var">type</var> is &lsquo;<samp 
class="samp">without-match</samp>&rsquo;,
-when <code class="command">grep</code> discovers null input binary data
-it assumes that the rest of the file does not match;
+when <code class="command">grep</code> discovers null binary data in an input 
file
+it assumes that any unprocessed input does not match;
 this is equivalent to the <samp class="option">-I</samp> option.
+In this case the region of unprocessed input starts no later than the
+null binary data, and continues to end of file.
 </p>
 <p>If <var class="var">type</var> is &lsquo;<samp 
class="samp">text</samp>&rsquo;,
 <code class="command">grep</code> processes binary data as if it were text;
@@ -763,6 +736,16 @@
 <var class="var">type</var> is &lsquo;<samp class="samp">binary</samp>&rsquo; 
the pattern &lsquo;<samp class="samp">.</samp>&rsquo; (period) might not
 match a null byte.
 </p>
+<p>The heuristic that <code class="command">grep</code> uses to intuit whether 
input is
+binary is specific to <code class="command">grep</code> and may well be 
unsuitable for
+other applications, as it depends on command-line options, on locale,
+and on hardware and operating system characteristics such as system
+page size and input buffering.  For example, if the input consists of
+a matching text line followed by nonmatching data that contains a null
+byte, <code class="command">grep</code> might either output the matching line 
or treat
+the file as binary, depending on whether the unprocessed input happens
+to include the matching text line.
+</p>
 <p><em class="emph">Warning:</em> The <samp class="option">-a</samp> (<samp 
class="option">--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
@@ -772,12 +755,11 @@
 even if the matches are unsafe for direct display.
 </p>
 </dd>
-<dt><samp class="option">-D <var class="var">action</var></samp></dt>
-<dt><samp class="option">--devices=<var class="var">action</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002dD"></a>
-<a class="index-entry-id" id="index-_002d_002ddevices"></a>
+<dt><a class="index-entry-id" id="index-_002d_002ddevices"></a>
 <a class="index-entry-id" id="index-device-search"></a>
-<p>If an input file is a device, FIFO, or socket, use <var 
class="var">action</var> to process it.
+<a id="index-_002dD"></a><span><samp class="option">-D <var 
class="var">action</var></samp><a class="copiable-link" href="#index-_002dD"> 
&para;</a></span></dt>
+<dt><samp class="option">--devices=<var class="var">action</var></samp></dt>
+<dd><p>If an input file is a device, FIFO, or socket, use <var 
class="var">action</var> to process it.
 If <var class="var">action</var> is &lsquo;<samp 
class="samp">read</samp>&rsquo;,
 all devices are read just as if they were ordinary files.
 If <var class="var">action</var> is &lsquo;<samp 
class="samp">skip</samp>&rsquo;,
@@ -789,13 +771,12 @@
 This option has no effect on a file that is read via standard input.
 </p>
 </dd>
-<dt><samp class="option">-d <var class="var">action</var></samp></dt>
-<dt><samp class="option">--directories=<var 
class="var">action</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002dd"></a>
-<a class="index-entry-id" id="index-_002d_002ddirectories"></a>
+<dt><a class="index-entry-id" id="index-_002d_002ddirectories"></a>
 <a class="index-entry-id" id="index-directory-search"></a>
 <a class="index-entry-id" id="index-symbolic-links"></a>
-<p>If an input file is a directory, use <var class="var">action</var> to 
process it.
+<a id="index-_002dd"></a><span><samp class="option">-d <var 
class="var">action</var></samp><a class="copiable-link" href="#index-_002dd"> 
&para;</a></span></dt>
+<dt><samp class="option">--directories=<var 
class="var">action</var></samp></dt>
+<dd><p>If an input file is a directory, use <var class="var">action</var> to 
process it.
 By default, <var class="var">action</var> is &lsquo;<samp 
class="samp">read</samp>&rsquo;,
 which means that directories are read just as if they were ordinary files
 (some operating systems and file systems disallow this,
@@ -808,34 +789,31 @@
 this is equivalent to the <samp class="option">-r</samp> option.
 </p>
 </dd>
-<dt><samp class="option">--exclude=<var class="var">glob</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dexclude"></a>
-<a class="index-entry-id" id="index-exclude-files"></a>
+<dt><a class="index-entry-id" id="index-exclude-files"></a>
 <a class="index-entry-id" id="index-searching-directory-trees"></a>
-<p>Skip any command-line file with a name suffix that matches the pattern
+<a id="index-_002d_002dexclude"></a><span><samp class="option">--exclude=<var 
class="var">glob</var></samp><a class="copiable-link" 
href="#index-_002d_002dexclude"> &para;</a></span></dt>
+<dd><p>Skip any command-line file with a name suffix that matches the pattern
 <var class="var">glob</var>, using wildcard matching; a name suffix is either 
the whole
 name, or a trailing part that starts with a non-slash character
 immediately after a slash (&lsquo;<samp class="samp">/</samp>&rsquo;) in the 
name.
 When searching recursively, skip any subfile whose base
 name matches <var class="var">glob</var>; the base name is the part after the 
last
 slash.  A pattern can use
-&lsquo;<samp class="samp">*</samp>&rsquo;, &lsquo;<samp 
class="samp">?</samp>&rsquo;, and &lsquo;<samp 
class="samp">[</samp>&rsquo;...&lsquo;<samp class="samp">]</samp>&rsquo; as 
wildcards,
+&lsquo;<samp class="samp">*</samp>&rsquo;, &lsquo;<samp 
class="samp">?</samp>&rsquo;, and &lsquo;<samp 
class="samp">[</samp>&rsquo;&hellip;&lsquo;<samp class="samp">]</samp>&rsquo; 
as wildcards,
 and <code class="code">\</code> to quote a wildcard or backslash character 
literally.
 </p>
 </dd>
-<dt><samp class="option">--exclude-from=<var class="var">file</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dexclude_002dfrom"></a>
-<a class="index-entry-id" id="index-exclude-files-1"></a>
+<dt><a class="index-entry-id" id="index-exclude-files-1"></a>
 <a class="index-entry-id" id="index-searching-directory-trees-1"></a>
-<p>Skip files whose name matches any of the patterns
+<a id="index-_002d_002dexclude_002dfrom"></a><span><samp 
class="option">--exclude-from=<var class="var">file</var></samp><a 
class="copiable-link" href="#index-_002d_002dexclude_002dfrom"> 
&para;</a></span></dt>
+<dd><p>Skip files whose name matches any of the patterns
 read from <var class="var">file</var> (using wildcard matching as described
 under <samp class="option">--exclude</samp>).
 </p>
 </dd>
-<dt><samp class="option">--exclude-dir=<var class="var">glob</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dexclude_002ddir"></a>
-<a class="index-entry-id" id="index-exclude-directories"></a>
-<p>Skip any command-line directory with a name suffix that matches the
+<dt><a class="index-entry-id" id="index-exclude-directories"></a>
+<a id="index-_002d_002dexclude_002ddir"></a><span><samp 
class="option">--exclude-dir=<var class="var">glob</var></samp><a 
class="copiable-link" href="#index-_002d_002dexclude_002ddir"> 
&para;</a></span></dt>
+<dd><p>Skip any command-line directory with a name suffix that matches the
 pattern <var class="var">glob</var>.  When searching recursively, skip any 
subdirectory
 whose base name matches <var class="var">glob</var>.  Ignore any redundant 
trailing
 slashes in <var class="var">glob</var>.
@@ -846,11 +824,10 @@
 this is equivalent to the &lsquo;<samp 
class="samp">--binary-files=without-match</samp>&rsquo; option.
 </p>
 </dd>
-<dt><samp class="option">--include=<var class="var">glob</var></samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dinclude"></a>
-<a class="index-entry-id" id="index-include-files"></a>
+<dt><a class="index-entry-id" id="index-include-files"></a>
 <a class="index-entry-id" id="index-searching-directory-trees-2"></a>
-<p>Search only files whose name matches <var class="var">glob</var>,
+<a id="index-_002d_002dinclude"></a><span><samp class="option">--include=<var 
class="var">glob</var></samp><a class="copiable-link" 
href="#index-_002d_002dinclude"> &para;</a></span></dt>
+<dd><p>Search only files whose name matches <var class="var">glob</var>,
 using wildcard matching as described under <samp 
class="option">--exclude</samp>.
 If contradictory <samp class="option">--include</samp> and <samp 
class="option">--exclude</samp> options are
 given, the last matching one wins.  If no <samp 
class="option">--include</samp> or
@@ -858,14 +835,13 @@
 such option is <samp class="option">--include</samp>.
 </p>
 </dd>
-<dt><samp class="option">-r</samp></dt>
-<dt><samp class="option">--recursive</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dr"></a>
-<a class="index-entry-id" id="index-_002d_002drecursive"></a>
+<dt><a class="index-entry-id" id="index-_002d_002drecursive"></a>
 <a class="index-entry-id" id="index-recursive-search"></a>
 <a class="index-entry-id" id="index-searching-directory-trees-3"></a>
 <a class="index-entry-id" id="index-symbolic-links-1"></a>
-<p>For each directory operand,
+<a id="index-_002dr"></a><span><samp class="option">-r</samp><a 
class="copiable-link" href="#index-_002dr"> &para;</a></span></dt>
+<dt><samp class="option">--recursive</samp></dt>
+<dd><p>For each directory operand,
 read and process all files in that directory, recursively.
 Follow symbolic links on the command line, but skip symlinks
 that are encountered recursively.
@@ -873,14 +849,13 @@
 This is the same as the &lsquo;<samp 
class="samp">--directories=recurse</samp>&rsquo; option.
 </p>
 </dd>
-<dt><samp class="option">-R</samp></dt>
-<dt><samp class="option">--dereference-recursive</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dR"></a>
-<a class="index-entry-id" id="index-_002d_002ddereference_002drecursive"></a>
+<dt><a class="index-entry-id" 
id="index-_002d_002ddereference_002drecursive"></a>
 <a class="index-entry-id" id="index-recursive-search-1"></a>
 <a class="index-entry-id" id="index-searching-directory-trees-4"></a>
 <a class="index-entry-id" id="index-symbolic-links-2"></a>
-<p>For each directory operand, read and process all files in that
+<a id="index-_002dR"></a><span><samp class="option">-R</samp><a 
class="copiable-link" href="#index-_002dR"> &para;</a></span></dt>
+<dt><samp class="option">--dereference-recursive</samp></dt>
+<dd><p>For each directory operand, read and process all files in that
 directory, recursively, following all symbolic links.
 </p>
 </dd>
@@ -896,32 +871,29 @@
 <h4 class="subsection" id="Other-Options-1"><span>2.1.7 Other Options<a 
class="copiable-link" href="#Other-Options-1"> &para;</a></span></h4>
 
 <dl class="table">
-<dt><samp class="option">--</samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002d"></a>
-<a class="index-entry-id" id="index-option-delimiter"></a>
-<p>Delimit the option list.  Later arguments, if any, are treated as
-operands even if they begin with &lsquo;<samp class="samp">-</samp>&rsquo;.  
For example, &lsquo;<samp class="samp">grep PAT --
--file1 file2</samp>&rsquo; searches for the pattern PAT in the files named 
<samp class="file">-file1</samp>
-and <samp class="file">file2</samp>.
+<dt><a class="index-entry-id" id="index-option-delimiter"></a>
+<a id="index-_002d_002d"></a><span><samp class="option">--</samp><a 
class="copiable-link" href="#index-_002d_002d"> &para;</a></span></dt>
+<dd><p>Delimit the option list.  Any later argument is not treated as an
+option even if it begins with &lsquo;<samp class="samp">-</samp>&rsquo;.  For 
example,
+&lsquo;<samp class="samp">grep -- -PAT -file1 file2</samp>&rsquo; searches for 
the pattern &lsquo;<samp class="samp">-PAT</samp>&rsquo;
+in the files named <samp class="file">-file1</samp> and <samp 
class="file">file2</samp>.
 </p>
 </dd>
-<dt><samp class="option">--line-buffered</samp></dt>
-<dd><a class="index-entry-id" id="index-_002d_002dline_002dbuffered"></a>
-<a class="index-entry-id" id="index-line-buffering"></a>
-<p>Use line buffering for standard output, regardless of output device.
+<dt><a class="index-entry-id" id="index-line-buffering"></a>
+<a id="index-_002d_002dline_002dbuffered"></a><span><samp 
class="option">--line-buffered</samp><a class="copiable-link" 
href="#index-_002d_002dline_002dbuffered"> &para;</a></span></dt>
+<dd><p>Use line buffering for standard output, regardless of output device.
 By default, standard output is line buffered for interactive devices,
 and is fully buffered otherwise.  With full buffering, the output
 buffer is flushed when full; with line buffering, the buffer is also
 flushed after every output line.  The buffer size is system dependent.
 </p>
 </dd>
-<dt><samp class="option">-U</samp></dt>
-<dt><samp class="option">--binary</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dU"></a>
-<a class="index-entry-id" id="index-_002d_002dbinary"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dbinary"></a>
 <a class="index-entry-id" id="index-MS_002dWindows-binary-I_002fO"></a>
 <a class="index-entry-id" id="index-binary-I_002fO"></a>
-<p>On platforms that distinguish between text and binary I/O,
+<a id="index-_002dU"></a><span><samp class="option">-U</samp><a 
class="copiable-link" href="#index-_002dU"> &para;</a></span></dt>
+<dt><samp class="option">--binary</samp></dt>
+<dd><p>On platforms that distinguish between text and binary I/O,
 use the latter when reading and writing files other
 than the user&rsquo;s terminal, so that all input bytes are read and written
 as-is.  This overrides the default behavior where <code 
class="command">grep</code>
@@ -942,12 +914,11 @@
 which do not distinguish text from binary I/O.
 </p>
 </dd>
-<dt><samp class="option">-z</samp></dt>
-<dt><samp class="option">--null-data</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dz"></a>
-<a class="index-entry-id" id="index-_002d_002dnull_002ddata"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dnull_002ddata"></a>
 <a class="index-entry-id" id="index-zero_002dterminated-lines"></a>
-<p>Treat input and output data as sequences of lines, each terminated by
+<a id="index-_002dz"></a><span><samp class="option">-z</samp><a 
class="copiable-link" href="#index-_002dz"> &para;</a></span></dt>
+<dt><samp class="option">--null-data</samp></dt>
+<dd><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 class="option">-Z</samp> or <samp class="option">--null</samp> 
option,
 this option can be used with commands like
@@ -998,20 +969,18 @@
 <p>The following environment variables affect the behavior of <code 
class="command">grep</code>.
 </p>
 <dl class="table">
-<dt><code class="env">GREP_COLOR</code></dt>
-<dd><a class="index-entry-id" 
id="index-GREP_005fCOLOR-environment-variable"></a>
-<a class="index-entry-id" id="index-highlight-markers"></a>
-<p>This obsolescent variable interacts with <code 
class="env">GREP_COLORS</code>
+<dt><a class="index-entry-id" id="index-highlight-markers"></a>
+<a id="index-GREP_005fCOLOR-environment-variable"></a><span><code 
class="env">GREP_COLOR</code><a class="copiable-link" 
href="#index-GREP_005fCOLOR-environment-variable"> &para;</a></span></dt>
+<dd><p>This obsolescent variable interacts with <code 
class="env">GREP_COLORS</code>
 confusingly, and <code class="command">grep</code> warns if it is set and is 
not
 overridden by <code class="env">GREP_COLORS</code>.  Instead of
 &lsquo;<samp class="samp">GREP_COLOR='<var 
class="var">color</var>'</samp>&rsquo;, you can use
 &lsquo;<samp class="samp">GREP_COLORS='mt=<var 
class="var">color</var>'</samp>&rsquo;.
 </p>
 </dd>
-<dt><code class="env">GREP_COLORS</code></dt>
-<dd><a class="index-entry-id" 
id="index-GREP_005fCOLORS-environment-variable"></a>
-<a class="index-entry-id" id="index-highlight-markers-1"></a>
-<p>This variable controls how the <samp class="option">--color</samp> option 
highlights output.
+<dt><a class="index-entry-id" id="index-highlight-markers-1"></a>
+<a id="index-GREP_005fCOLORS-environment-variable"></a><span><code 
class="env">GREP_COLORS</code><a class="copiable-link" 
href="#index-GREP_005fCOLORS-environment-variable"> &para;</a></span></dt>
+<dd><p>This variable controls how the <samp class="option">--color</samp> 
option highlights output.
 Its value is a colon-separated list of <code class="code">terminfo</code> 
capabilities
 that defaults to &lsquo;<samp 
class="samp">ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36</samp>&rsquo;
 with the &lsquo;<samp class="samp">rv</samp>&rsquo; and &lsquo;<samp 
class="samp">ne</samp>&rsquo; boolean capabilities omitted (i.e., false).
@@ -1031,7 +1000,7 @@
 These substring values are integers in decimal representation
 and can be concatenated with semicolons.
 <code class="command">grep</code> takes care of assembling the result
-into a complete SGR sequence (&lsquo;<samp 
class="samp">\33[</samp>&rsquo;...&lsquo;<samp class="samp">m</samp>&rsquo;).
+into a complete SGR sequence (&lsquo;<samp 
class="samp">\33[</samp>&rsquo;&hellip;&lsquo;<samp 
class="samp">m</samp>&rsquo;).
 Common values to concatenate include
 &lsquo;<samp class="samp">1</samp>&rsquo; for bold,
 &lsquo;<samp class="samp">4</samp>&rsquo; for underline,
@@ -1051,9 +1020,8 @@
 <p>Supported capabilities are as follows.
 </p>
 <dl class="table">
-<dt><code class="code">sl=</code></dt>
-<dd><a class="index-entry-id" id="index-sl-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for whole selected lines
+<dt><a id="index-sl-GREP_005fCOLORS-capability"></a><span><code 
class="code">sl=</code><a class="copiable-link" 
href="#index-sl-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for whole selected lines
 (i.e.,
 matching lines when the <samp class="option">-v</samp> command-line option is 
omitted,
 or non-matching lines when <samp class="option">-v</samp> is specified).
@@ -1063,9 +1031,8 @@
 The default is empty (i.e., the terminal&rsquo;s default color pair).
 </p>
 </dd>
-<dt><code class="code">cx=</code></dt>
-<dd><a class="index-entry-id" id="index-cx-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for whole context lines
+<dt><a id="index-cx-GREP_005fCOLORS-capability"></a><span><code 
class="code">cx=</code><a class="copiable-link" 
href="#index-cx-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for whole context lines
 (i.e.,
 non-matching lines when the <samp class="option">-v</samp> command-line option 
is omitted,
 or matching lines when <samp class="option">-v</samp> is specified).
@@ -1075,17 +1042,15 @@
 The default is empty (i.e., the terminal&rsquo;s default color pair).
 </p>
 </dd>
-<dt><code class="code">rv</code></dt>
-<dd><a class="index-entry-id" id="index-rv-GREP_005fCOLORS-capability"></a>
-<p>Boolean value that reverses (swaps) the meanings of
+<dt><a id="index-rv-GREP_005fCOLORS-capability"></a><span><code 
class="code">rv</code><a class="copiable-link" 
href="#index-rv-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>Boolean value that reverses (swaps) the meanings of
 the &lsquo;<samp class="samp">sl=</samp>&rsquo; and &lsquo;<samp 
class="samp">cx=</samp>&rsquo; capabilities
 when the <samp class="option">-v</samp> command-line option is specified.
 The default is false (i.e., the capability is omitted).
 </p>
 </dd>
-<dt><code class="code">mt=01;31</code></dt>
-<dd><a class="index-entry-id" id="index-mt-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for matching non-empty text in any matching line
+<dt><a id="index-mt-GREP_005fCOLORS-capability"></a><span><code 
class="code">mt=01;31</code><a class="copiable-link" 
href="#index-mt-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for matching non-empty text in any matching line
 (i.e.,
 a selected line when the <samp class="option">-v</samp> command-line option is 
omitted,
 or a context line when <samp class="option">-v</samp> is specified).
@@ -1094,45 +1059,39 @@
 The default is a bold red text foreground over the current line background.
 </p>
 </dd>
-<dt><code class="code">ms=01;31</code></dt>
-<dd><a class="index-entry-id" id="index-ms-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for matching non-empty text in a selected line.
+<dt><a id="index-ms-GREP_005fCOLORS-capability"></a><span><code 
class="code">ms=01;31</code><a class="copiable-link" 
href="#index-ms-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for matching non-empty text in a selected line.
 (This is used only when the <samp class="option">-v</samp> command-line option 
is omitted.)
 The effect of the &lsquo;<samp class="samp">sl=</samp>&rsquo; (or &lsquo;<samp 
class="samp">cx=</samp>&rsquo; if &lsquo;<samp class="samp">rv</samp>&rsquo;) 
capability
 remains active when this takes effect.
 The default is a bold red text foreground over the current line background.
 </p>
 </dd>
-<dt><code class="code">mc=01;31</code></dt>
-<dd><a class="index-entry-id" id="index-mc-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for matching non-empty text in a context line.
+<dt><a id="index-mc-GREP_005fCOLORS-capability"></a><span><code 
class="code">mc=01;31</code><a class="copiable-link" 
href="#index-mc-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for matching non-empty text in a context line.
 (This is used only when the <samp class="option">-v</samp> command-line option 
is specified.)
 The effect of the &lsquo;<samp class="samp">cx=</samp>&rsquo; (or &lsquo;<samp 
class="samp">sl=</samp>&rsquo; if &lsquo;<samp class="samp">rv</samp>&rsquo;) 
capability
 remains active when this takes effect.
 The default is a bold red text foreground over the current line background.
 </p>
 </dd>
-<dt><code class="code">fn=35</code></dt>
-<dd><a class="index-entry-id" id="index-fn-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for file names prefixing any content line.
+<dt><a id="index-fn-GREP_005fCOLORS-capability"></a><span><code 
class="code">fn=35</code><a class="copiable-link" 
href="#index-fn-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for file names prefixing any content line.
 The default is a magenta text foreground over the terminal&rsquo;s default 
background.
 </p>
 </dd>
-<dt><code class="code">ln=32</code></dt>
-<dd><a class="index-entry-id" id="index-ln-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for line numbers prefixing any content line.
+<dt><a id="index-ln-GREP_005fCOLORS-capability"></a><span><code 
class="code">ln=32</code><a class="copiable-link" 
href="#index-ln-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for line numbers prefixing any content line.
 The default is a green text foreground over the terminal&rsquo;s default 
background.
 </p>
 </dd>
-<dt><code class="code">bn=32</code></dt>
-<dd><a class="index-entry-id" id="index-bn-GREP_005fCOLORS-capability"></a>
-<p>SGR substring for byte offsets prefixing any content line.
+<dt><a id="index-bn-GREP_005fCOLORS-capability"></a><span><code 
class="code">bn=32</code><a class="copiable-link" 
href="#index-bn-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>SGR substring for byte offsets prefixing any content line.
 The default is a green text foreground over the terminal&rsquo;s default 
background.
 </p>
 </dd>
-<dt><code class="code">se=36</code></dt>
-<dd><a class="index-entry-id" id="index-fn-GREP_005fCOLORS-capability-1"></a>
-<p>SGR substring for separators that are inserted
+<dt><a id="index-fn-GREP_005fCOLORS-capability-1"></a><span><code 
class="code">se=36</code><a class="copiable-link" 
href="#index-fn-GREP_005fCOLORS-capability-1"> &para;</a></span></dt>
+<dd><p>SGR substring for separators that are inserted
 between selected line fields (&lsquo;<samp class="samp">:</samp>&rsquo;),
 between context line fields (&lsquo;<samp class="samp">-</samp>&rsquo;),
 and between groups of adjacent lines
@@ -1140,9 +1099,8 @@
 The default is a cyan text foreground over the terminal&rsquo;s default 
background.
 </p>
 </dd>
-<dt><code class="code">ne</code></dt>
-<dd><a class="index-entry-id" id="index-ne-GREP_005fCOLORS-capability"></a>
-<p>Boolean value that prevents clearing to the end of line
+<dt><a id="index-ne-GREP_005fCOLORS-capability"></a><span><code 
class="code">ne</code><a class="copiable-link" 
href="#index-ne-GREP_005fCOLORS-capability"> &para;</a></span></dt>
+<dd><p>Boolean value that prevents clearing to the end of line
 using Erase in Line (EL) to Right (&lsquo;<samp 
class="samp">\33[K</samp>&rsquo;)
 each time a colorized item ends.
 This is needed on terminals on which EL is not supported.
@@ -1155,60 +1113,56 @@
 </p></dd>
 </dl>
 
-<p>Note that boolean capabilities have no &lsquo;<samp 
class="samp">=</samp>&rsquo;... part.
+<p>Note that boolean capabilities have no &lsquo;<samp 
class="samp">=</samp>&rsquo;&hellip; part.
 They are omitted (i.e., false) by default and become true when specified.
 </p>
 
 </dd>
-<dt><code class="env">LC_ALL</code></dt>
-<dt><code class="env">LC_COLLATE</code></dt>
-<dt><code class="env">LANG</code></dt>
-<dd><a class="index-entry-id" id="index-LC_005fALL-environment-variable-1"></a>
-<a class="index-entry-id" id="index-LC_005fCOLLATE-environment-variable"></a>
+<dt><a class="index-entry-id" 
id="index-LC_005fCOLLATE-environment-variable"></a>
 <a class="index-entry-id" id="index-LANG-environment-variable-1"></a>
 <a class="index-entry-id" id="index-character-type"></a>
 <a class="index-entry-id" id="index-national-language-support"></a>
 <a class="index-entry-id" id="index-NLS"></a>
-<p>These variables specify the locale for the <code 
class="env">LC_COLLATE</code> category,
+<a id="index-LC_005fALL-environment-variable-1"></a><span><code 
class="env">LC_ALL</code><a class="copiable-link" 
href="#index-LC_005fALL-environment-variable-1"> &para;</a></span></dt>
+<dt><code class="env">LC_COLLATE</code></dt>
+<dt><code class="env">LANG</code></dt>
+<dd><p>These variables specify the locale for the <code 
class="env">LC_COLLATE</code> category,
 which might affect how range expressions like &lsquo;<samp 
class="samp">a-z</samp>&rsquo; are
 interpreted.
 </p>
 </dd>
-<dt><code class="env">LC_ALL</code></dt>
-<dt><code class="env">LC_CTYPE</code></dt>
-<dt><code class="env">LANG</code></dt>
-<dd><a class="index-entry-id" id="index-LC_005fALL-environment-variable-2"></a>
-<a class="index-entry-id" id="index-LC_005fCTYPE-environment-variable"></a>
+<dt><a class="index-entry-id" id="index-LC_005fCTYPE-environment-variable"></a>
 <a class="index-entry-id" id="index-LANG-environment-variable-2"></a>
 <a class="index-entry-id" id="index-encoding-error"></a>
 <a class="index-entry-id" id="index-null-character"></a>
-<p>These variables specify the locale for the <code 
class="env">LC_CTYPE</code> category,
+<a id="index-LC_005fALL-environment-variable-2"></a><span><code 
class="env">LC_ALL</code><a class="copiable-link" 
href="#index-LC_005fALL-environment-variable-2"> &para;</a></span></dt>
+<dt><code class="env">LC_CTYPE</code></dt>
+<dt><code class="env">LANG</code></dt>
+<dd><p>These variables specify the locale for the <code 
class="env">LC_CTYPE</code> category,
 which determines the type of characters,
 e.g., which characters are whitespace.
 This category also determines the character encoding.
 See <a class="xref" href="#Character-Encoding">Character Encoding</a>.
 </p>
 </dd>
-<dt><code class="env">LANGUAGE</code></dt>
-<dt><code class="env">LC_ALL</code></dt>
-<dt><code class="env">LC_MESSAGES</code></dt>
-<dt><code class="env">LANG</code></dt>
-<dd><a class="index-entry-id" id="index-LANGUAGE-environment-variable-1"></a>
-<a class="index-entry-id" id="index-LC_005fALL-environment-variable-3"></a>
+<dt><a class="index-entry-id" id="index-LC_005fALL-environment-variable-3"></a>
 <a class="index-entry-id" 
id="index-LC_005fMESSAGES-environment-variable-1"></a>
 <a class="index-entry-id" id="index-LANG-environment-variable-3"></a>
 <a class="index-entry-id" id="index-language-of-messages"></a>
 <a class="index-entry-id" id="index-message-language"></a>
 <a class="index-entry-id" id="index-national-language-support-1"></a>
 <a class="index-entry-id" id="index-translation-of-message-language"></a>
-<p>These variables specify the locale for the <code 
class="env">LC_MESSAGES</code> category,
+<a id="index-LANGUAGE-environment-variable-1"></a><span><code 
class="env">LANGUAGE</code><a class="copiable-link" 
href="#index-LANGUAGE-environment-variable-1"> &para;</a></span></dt>
+<dt><code class="env">LC_ALL</code></dt>
+<dt><code class="env">LC_MESSAGES</code></dt>
+<dt><code class="env">LANG</code></dt>
+<dd><p>These variables specify the locale for the <code 
class="env">LC_MESSAGES</code> category,
 which determines the language that <code class="command">grep</code> uses for 
messages.
 The default &lsquo;<samp class="samp">C</samp>&rsquo; locale uses American 
English messages.
 </p>
 </dd>
-<dt><code class="env">POSIXLY_CORRECT</code></dt>
-<dd><a class="index-entry-id" 
id="index-POSIXLY_005fCORRECT-environment-variable"></a>
-<p>If set, <code class="command">grep</code> behaves as POSIX requires; 
otherwise,
+<dt><a id="index-POSIXLY_005fCORRECT-environment-variable"></a><span><code 
class="env">POSIXLY_CORRECT</code><a class="copiable-link" 
href="#index-POSIXLY_005fCORRECT-environment-variable"> &para;</a></span></dt>
+<dd><p>If set, <code class="command">grep</code> behaves as POSIX requires; 
otherwise,
 <code class="command">grep</code> behaves more like other GNU programs.
 POSIX
 requires that options that
@@ -1218,9 +1172,8 @@
 and are treated as options.
 </p>
 </dd>
-<dt><code class="env">TERM</code></dt>
-<dd><a class="index-entry-id" id="index-TERM-environment-variable"></a>
-<p>This variable specifies the output terminal type, which can affect
+<dt><a id="index-TERM-environment-variable"></a><span><code 
class="env">TERM</code><a class="copiable-link" 
href="#index-TERM-environment-variable"> &para;</a></span></dt>
+<dd><p>This variable specifies the output terminal type, which can affect
 what the <samp class="option">--color</samp> option does.  See <a class="xref" 
href="#General-Output-Control">General Output Control</a>.
 </p>
 </dd>
@@ -1281,54 +1234,77 @@
 controlled by the following options.
 </p>
 <dl class="table">
-<dt><samp class="option">-G</samp></dt>
-<dt><samp class="option">--basic-regexp</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dG"></a>
-<a class="index-entry-id" id="index-_002d_002dbasic_002dregexp"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dbasic_002dregexp"></a>
 <a class="index-entry-id" id="index-matching-basic-regular-expressions"></a>
-<p>Interpret patterns as basic regular expressions (BREs).
+<a id="index-_002dG"></a><span><samp class="option">-G</samp><a 
class="copiable-link" href="#index-_002dG"> &para;</a></span></dt>
+<dt><samp class="option">--basic-regexp</samp></dt>
+<dd><p>Interpret patterns as basic regular expressions (BREs).
 This is the default.
 </p>
 </dd>
-<dt><samp class="option">-E</samp></dt>
-<dt><samp class="option">--extended-regexp</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dE"></a>
-<a class="index-entry-id" id="index-_002d_002dextended_002dregexp"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dextended_002dregexp"></a>
 <a class="index-entry-id" id="index-matching-extended-regular-expressions"></a>
-<p>Interpret patterns as extended regular expressions (EREs).
+<a id="index-_002dE"></a><span><samp class="option">-E</samp><a 
class="copiable-link" href="#index-_002dE"> &para;</a></span></dt>
+<dt><samp class="option">--extended-regexp</samp></dt>
+<dd><p>Interpret patterns as extended regular expressions (EREs).
 (<samp class="option">-E</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-F</samp></dt>
-<dt><samp class="option">--fixed-strings</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dF"></a>
-<a class="index-entry-id" id="index-_002d_002dfixed_002dstrings"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dfixed_002dstrings"></a>
 <a class="index-entry-id" id="index-matching-fixed-strings"></a>
-<p>Interpret patterns as fixed strings, not regular expressions.
+<a id="index-_002dF"></a><span><samp class="option">-F</samp><a 
class="copiable-link" href="#index-_002dF"> &para;</a></span></dt>
+<dt><samp class="option">--fixed-strings</samp></dt>
+<dd><p>Interpret patterns as fixed strings, not regular expressions.
 (<samp class="option">-F</samp> is specified by POSIX.)
 </p>
 </dd>
-<dt><samp class="option">-P</samp></dt>
-<dt><samp class="option">--perl-regexp</samp></dt>
-<dd><a class="index-entry-id" id="index-_002dP"></a>
-<a class="index-entry-id" id="index-_002d_002dperl_002dregexp"></a>
+<dt><a class="index-entry-id" id="index-_002d_002dperl_002dregexp"></a>
 <a class="index-entry-id" 
id="index-matching-Perl_002dcompatible-regular-expressions"></a>
-<p>Interpret patterns as Perl-compatible regular expressions (PCREs).
-PCRE support is here to stay, but consider this option experimental when
-combined with the <samp class="option">-z</samp> (<samp 
class="option">--null-data</samp>) option, and note that
-&lsquo;<samp class="samp">grep&nbsp;-P</samp>&rsquo; may warn of unimplemented 
features.
-See <a class="xref" href="#Other-Options">Other Options</a>.
+<a id="index-_002dP"></a><span><samp class="option">-P</samp><a 
class="copiable-link" href="#index-_002dP"> &para;</a></span></dt>
+<dt><samp class="option">--perl-regexp</samp></dt>
+<dd><p>Interpret patterns as Perl-compatible regular expressions (PCREs).
 </p>
 <p>For documentation, refer to <a class="url" 
href="https://www.pcre.org/";>https://www.pcre.org/</a>, with these caveats:
 </p><ul class="itemize mark-bullet">
-<li>&lsquo;<samp class="samp">\d</samp>&rsquo; matches only the ten ASCII 
digits
-(and &lsquo;<samp class="samp">\D</samp>&rsquo; matches the complement), 
regardless of locale.
-Use &lsquo;<samp class="samp">\p{Nd}</samp>&rsquo; to also match non-ASCII 
digits.
-(The behavior of &lsquo;<samp class="samp">\d</samp>&rsquo; and &lsquo;<samp 
class="samp">\D</samp>&rsquo; is unspecified after
-in-regexp directives like &lsquo;<samp class="samp">(?aD)</samp>&rsquo;.)
+<li>In a UTF-8 locale, Perl treats data as UTF-8 only under certain
+conditions, e.g., if <code class="command">perl</code> is invoked with the 
<samp class="option">-C</samp>
+option or the <code class="env">PERL_UNICODE</code> environment variable set 
appropriately.
+Similarly, <code class="command">pcre2grep</code> treats data as UTF-8 only if
+invoked with <samp class="option">-u</samp> or <samp class="option">-U</samp>.
+In contrast, in a UTF-8 locale <code class="command">grep</code> and <code 
class="command">git grep</code>
+always treat data as UTF-8.
+
+</li><li>In Perl and <code class="command">git grep -P</code>, &lsquo;<samp 
class="samp">\d</samp>&rsquo; matches all Unicode digits,
+even if they are not ASCII.
+For example, &lsquo;<samp class="samp">\d</samp>&rsquo; matches
+&ldquo;Ù£&rdquo;
+(U+0663 ARABIC-INDIC DIGIT THREE).
+In contrast, in &lsquo;<samp class="samp">grep -P</samp>&rsquo;, &lsquo;<samp 
class="samp">\d</samp>&rsquo; matches only
+the ten ASCII digits, regardless of locale.
+In <code class="command">pcre2grep</code>, &lsquo;<samp 
class="samp">\d</samp>&rsquo; ordinarily behaves like Perl and
+<code class="command">git grep -P</code>, but when given the <samp 
class="option">--posix-digit</samp> option
+it behaves like &lsquo;<samp class="samp">grep -P</samp>&rsquo;.
+(On all platforms, &lsquo;<samp class="samp">\D</samp>&rsquo; matches the 
complement of &lsquo;<samp class="samp">\d</samp>&rsquo;.)
+
+</li><li>The pattern &lsquo;<samp class="samp">[[:digit:]]</samp>&rsquo; 
matches all Unicode digits
+in Perl, &lsquo;<samp class="samp">grep -P</samp>&rsquo;, <code 
class="command">git grep -P</code>, and <code class="command">pcre2grep</code>,
+so you can use it
+to get the effect of Perl&rsquo;s &lsquo;<samp class="samp">\d</samp>&rsquo; 
on all these platforms.
+In other words, in Perl and <code class="command">git grep -P</code>,
+&lsquo;<samp class="samp">\d</samp>&rsquo; is equivalent to &lsquo;<samp 
class="samp">[[:digit:]]</samp>&rsquo;,
+whereas in &lsquo;<samp class="samp">grep -P</samp>&rsquo;, &lsquo;<samp 
class="samp">\d</samp>&rsquo; is equivalent to &lsquo;<samp 
class="samp">[0-9]</samp>&rsquo;,
+and <code class="command">pcre2grep</code> ordinarily follows Perl but
+when given <samp class="option">--posix-digit</samp> it follows &lsquo;<samp 
class="samp">grep -P</samp>&rsquo;.
+
+<p>(On all these platforms, &lsquo;<samp 
class="samp">[[:digit:]]</samp>&rsquo; is equivalent to &lsquo;<samp 
class="samp">\p{Nd}</samp>&rsquo;
+and to &lsquo;<samp class="samp">\p{General_Category: 
Decimal_Number}</samp>&rsquo;.)
+</p>
+</li><li>If <code class="command">grep</code> is built with PCRE2 version 
10.43 (2024) or later,
+&lsquo;<samp class="samp">(?aD)</samp>&rsquo; causes &lsquo;<samp 
class="samp">\d</samp>&rsquo; to behave like &lsquo;<samp 
class="samp">[0-9]</samp>&rsquo; and
+&lsquo;<samp class="samp">(?-aD)</samp>&rsquo; causes it to behave like 
&lsquo;<samp class="samp">[[:digit:]]</samp>&rsquo;.
 
 </li><li>Although PCRE tracks the syntax and semantics of Perl&rsquo;s regular
-expressions, the match is not always exact.  For example, Perl
+expressions, the match is not always exact.  Perl
 evolves and a Perl installation may predate or postdate the PCRE2
 installation on the same host, or their Unicode versions may differ,
 or Perl and PCRE2 may disagree about an obscure construct.
@@ -1419,54 +1395,47 @@
 are called <em class="dfn">interval expressions</em>.
 </p>
 <dl class="table">
-<dt>&lsquo;<samp class="samp">?</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-_003f"></a>
-<a class="index-entry-id" id="index-question-mark"></a>
+<dt><a class="index-entry-id" id="index-question-mark"></a>
 <a class="index-entry-id" id="index-match-expression-at-most-once"></a>
-<p>The preceding item is optional and is matched at most once.
+<a id="index-_003f"></a><span>&lsquo;<samp class="samp">?</samp>&rsquo;<a 
class="copiable-link" href="#index-_003f"> &para;</a></span></dt>
+<dd><p>The preceding item is optional and is matched at most once.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">*</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-_002a"></a>
-<a class="index-entry-id" id="index-asterisk"></a>
+<dt><a class="index-entry-id" id="index-asterisk"></a>
 <a class="index-entry-id" id="index-match-expression-zero-or-more-times"></a>
-<p>The preceding item is matched zero or more times.
+<a id="index-_002a"></a><span>&lsquo;<samp class="samp">*</samp>&rsquo;<a 
class="copiable-link" href="#index-_002a"> &para;</a></span></dt>
+<dd><p>The preceding item is matched zero or more times.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">+</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-_002b"></a>
-<a class="index-entry-id" id="index-plus-sign"></a>
+<dt><a class="index-entry-id" id="index-plus-sign"></a>
 <a class="index-entry-id" id="index-match-expression-one-or-more-times"></a>
-<p>The preceding item is matched one or more times.
+<a id="index-_002b"></a><span>&lsquo;<samp class="samp">+</samp>&rsquo;<a 
class="copiable-link" href="#index-_002b"> &para;</a></span></dt>
+<dd><p>The preceding item is matched one or more times.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">{<var class="var">n</var>}</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-_007bn_007d"></a>
-<a class="index-entry-id" id="index-braces_002c-one-argument"></a>
+<dt><a class="index-entry-id" id="index-braces_002c-one-argument"></a>
 <a class="index-entry-id" id="index-match-expression-n-times"></a>
-<p>The preceding item is matched exactly <var class="var">n</var> times.
+<a id="index-_007bn_007d"></a><span>&lsquo;<samp class="samp">{<var 
class="var">n</var>}</samp>&rsquo;<a class="copiable-link" 
href="#index-_007bn_007d"> &para;</a></span></dt>
+<dd><p>The preceding item is matched exactly <var class="var">n</var> times.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">{<var class="var">n</var>,}</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-_007bn_002c_007d"></a>
-<a class="index-entry-id" id="index-braces_002c-second-argument-omitted"></a>
+<dt><a class="index-entry-id" 
id="index-braces_002c-second-argument-omitted"></a>
 <a class="index-entry-id" id="index-match-expression-n-or-more-times"></a>
-<p>The preceding item is matched <var class="var">n</var> or more times.
+<a id="index-_007bn_002c_007d"></a><span>&lsquo;<samp class="samp">{<var 
class="var">n</var>,}</samp>&rsquo;<a class="copiable-link" 
href="#index-_007bn_002c_007d"> &para;</a></span></dt>
+<dd><p>The preceding item is matched <var class="var">n</var> or more times.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">{,<var class="var">m</var>}</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-_007b_002cm_007d"></a>
-<a class="index-entry-id" id="index-braces_002c-first-argument-omitted"></a>
+<dt><a class="index-entry-id" 
id="index-braces_002c-first-argument-omitted"></a>
 <a class="index-entry-id" id="index-match-expression-at-most-m-times"></a>
-<p>The preceding item is matched at most <var class="var">m</var> times.
+<a id="index-_007b_002cm_007d"></a><span>&lsquo;<samp class="samp">{,<var 
class="var">m</var>}</samp>&rsquo;<a class="copiable-link" 
href="#index-_007b_002cm_007d"> &para;</a></span></dt>
+<dd><p>The preceding item is matched at most <var class="var">m</var> times.
 This is a GNU extension.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">{<var class="var">n</var>,<var 
class="var">m</var>}</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-_007bn_002cm_007d"></a>
-<a class="index-entry-id" id="index-braces_002c-two-arguments"></a>
+<dt><a class="index-entry-id" id="index-braces_002c-two-arguments"></a>
 <a class="index-entry-id" id="index-match-expression-from-n-to-m-times"></a>
-<p>The preceding item is matched at least <var class="var">n</var> times, but 
not more than
+<a id="index-_007bn_002cm_007d"></a><span>&lsquo;<samp class="samp">{<var 
class="var">n</var>,<var class="var">m</var>}</samp>&rsquo;<a 
class="copiable-link" href="#index-_007bn_002cm_007d"> &para;</a></span></dt>
+<dd><p>The preceding item is matched at least <var class="var">n</var> times, 
but not more than
 <var class="var">m</var> times.
 </p>
 </dd>
@@ -1518,13 +1487,13 @@
 <a class="index-entry-id" id="index-range-expression"></a>
 <p>Within a bracket expression, a <em class="dfn">range expression</em> 
consists of two
 characters separated by a hyphen.
-It matches any single character that
-sorts between the two characters, inclusive.
-In the default C locale, the sorting sequence is the native character
-order; for example, &lsquo;<samp class="samp">[a-d]</samp>&rsquo; is 
equivalent to &lsquo;<samp class="samp">[abcd]</samp>&rsquo;.
-In other locales, the sorting sequence is not specified, and
-&lsquo;<samp class="samp">[a-d]</samp>&rsquo; might be equivalent to 
&lsquo;<samp class="samp">[abcd]</samp>&rsquo; or to
-&lsquo;<samp class="samp">[aBbCcDd]</samp>&rsquo;, or it might fail to match 
any character, or the set of
+In the default C locale, it matches any single character that appears
+between the two characters in ASCII order, inclusive.
+For example, &lsquo;<samp class="samp">[a-d]</samp>&rsquo; is equivalent to 
&lsquo;<samp class="samp">[abcd]</samp>&rsquo;.
+In other locales the behavior is unspecified:
+&lsquo;<samp class="samp">[a-d]</samp>&rsquo; might be equivalent to
+&lsquo;<samp class="samp">[abcd]</samp>&rsquo; or &lsquo;<samp 
class="samp">[aBbCcDd]</samp>&rsquo; or some other bracket expression,
+or it might fail to match any character, or the set of
 characters that it matches might be erratic, or it might be invalid.
 To obtain the traditional interpretation
 of bracket expressions, you can use the &lsquo;<samp 
class="samp">C</samp>&rsquo; locale by setting the
@@ -1539,98 +1508,86 @@
 <a class="index-entry-id" id="index-classes-of-characters"></a>
 <a class="index-entry-id" id="index-character-classes"></a>
 <dl class="table">
-<dt>&lsquo;<samp class="samp">[:alnum:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-alnum-character-class"></a>
-<a class="index-entry-id" id="index-alphanumeric-characters"></a>
-<p>Alphanumeric characters:
+<dt><a class="index-entry-id" id="index-alphanumeric-characters"></a>
+<a id="index-alnum-character-class"></a><span>&lsquo;<samp 
class="samp">[:alnum:]</samp>&rsquo;<a class="copiable-link" 
href="#index-alnum-character-class"> &para;</a></span></dt>
+<dd><p>Alphanumeric characters:
 &lsquo;<samp class="samp">[:alpha:]</samp>&rsquo; and &lsquo;<samp 
class="samp">[:digit:]</samp>&rsquo;; in the &lsquo;<samp 
class="samp">C</samp>&rsquo; locale and ASCII
 character encoding, this is the same as &lsquo;<samp 
class="samp">[0-9A-Za-z]</samp>&rsquo;.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:alpha:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-alpha-character-class"></a>
-<a class="index-entry-id" id="index-alphabetic-characters"></a>
-<p>Alphabetic characters:
+<dt><a class="index-entry-id" id="index-alphabetic-characters"></a>
+<a id="index-alpha-character-class"></a><span>&lsquo;<samp 
class="samp">[:alpha:]</samp>&rsquo;<a class="copiable-link" 
href="#index-alpha-character-class"> &para;</a></span></dt>
+<dd><p>Alphabetic characters:
 &lsquo;<samp class="samp">[:lower:]</samp>&rsquo; and &lsquo;<samp 
class="samp">[:upper:]</samp>&rsquo;; in the &lsquo;<samp 
class="samp">C</samp>&rsquo; locale and ASCII
 character encoding, this is the same as &lsquo;<samp 
class="samp">[A-Za-z]</samp>&rsquo;.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:blank:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-blank-character-class"></a>
-<a class="index-entry-id" id="index-blank-characters"></a>
-<p>Blank characters:
+<dt><a class="index-entry-id" id="index-blank-characters"></a>
+<a id="index-blank-character-class"></a><span>&lsquo;<samp 
class="samp">[:blank:]</samp>&rsquo;<a class="copiable-link" 
href="#index-blank-character-class"> &para;</a></span></dt>
+<dd><p>Blank characters:
 space and tab.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:cntrl:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-cntrl-character-class"></a>
-<a class="index-entry-id" id="index-control-characters"></a>
-<p>Control characters.
+<dt><a class="index-entry-id" id="index-control-characters"></a>
+<a id="index-cntrl-character-class"></a><span>&lsquo;<samp 
class="samp">[:cntrl:]</samp>&rsquo;<a class="copiable-link" 
href="#index-cntrl-character-class"> &para;</a></span></dt>
+<dd><p>Control characters.
 In ASCII, these characters have octal codes 000
 through 037, and 177 (DEL).
 In other character sets, these are
 the equivalent characters, if any.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:digit:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-digit-character-class"></a>
-<a class="index-entry-id" id="index-digit-characters"></a>
+<dt><a class="index-entry-id" id="index-digit-characters"></a>
 <a class="index-entry-id" id="index-numeric-characters"></a>
-<p>Digits: <code class="code">0 1 2 3 4 5 6 7 8 9</code>.
+<a id="index-digit-character-class"></a><span>&lsquo;<samp 
class="samp">[:digit:]</samp>&rsquo;<a class="copiable-link" 
href="#index-digit-character-class"> &para;</a></span></dt>
+<dd><p>Digits: <code class="code">0 1 2 3 4 5 6 7 8 9</code>.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:graph:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-graph-character-class"></a>
-<a class="index-entry-id" id="index-graphic-characters"></a>
-<p>Graphical characters:
+<dt><a class="index-entry-id" id="index-graphic-characters"></a>
+<a id="index-graph-character-class"></a><span>&lsquo;<samp 
class="samp">[:graph:]</samp>&rsquo;<a class="copiable-link" 
href="#index-graph-character-class"> &para;</a></span></dt>
+<dd><p>Graphical characters:
 &lsquo;<samp class="samp">[:alnum:]</samp>&rsquo; and &lsquo;<samp 
class="samp">[:punct:]</samp>&rsquo;.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:lower:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-lower-character-class"></a>
-<a class="index-entry-id" id="index-lower_002dcase-letters"></a>
-<p>Lower-case letters; in the &lsquo;<samp class="samp">C</samp>&rsquo; locale 
and ASCII character
+<dt><a class="index-entry-id" id="index-lower_002dcase-letters"></a>
+<a id="index-lower-character-class"></a><span>&lsquo;<samp 
class="samp">[:lower:]</samp>&rsquo;<a class="copiable-link" 
href="#index-lower-character-class"> &para;</a></span></dt>
+<dd><p>Lower-case letters; in the &lsquo;<samp class="samp">C</samp>&rsquo; 
locale and ASCII character
 encoding, this is
 <code class="code">a b c d e f g h i j k l m n o p q r s t u v w x y z</code>.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:print:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-print-character-class"></a>
-<a class="index-entry-id" id="index-printable-characters"></a>
-<p>Printable characters:
+<dt><a class="index-entry-id" id="index-printable-characters"></a>
+<a id="index-print-character-class"></a><span>&lsquo;<samp 
class="samp">[:print:]</samp>&rsquo;<a class="copiable-link" 
href="#index-print-character-class"> &para;</a></span></dt>
+<dd><p>Printable characters:
 &lsquo;<samp class="samp">[:alnum:]</samp>&rsquo;, &lsquo;<samp 
class="samp">[:punct:]</samp>&rsquo;, and space.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:punct:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-punct-character-class"></a>
-<a class="index-entry-id" id="index-punctuation-characters"></a>
-<p>Punctuation characters; in the &lsquo;<samp class="samp">C</samp>&rsquo; 
locale and ASCII character
+<dt><a class="index-entry-id" id="index-punctuation-characters"></a>
+<a id="index-punct-character-class"></a><span>&lsquo;<samp 
class="samp">[:punct:]</samp>&rsquo;<a class="copiable-link" 
href="#index-punct-character-class"> &para;</a></span></dt>
+<dd><p>Punctuation characters; in the &lsquo;<samp 
class="samp">C</samp>&rsquo; locale and ASCII character
 encoding, this is
 <code class="code">! &quot; # $ % &amp; ' ( ) * + , - . / : ; &lt; = &gt; ? @ 
[ \ ] ^ _ ` { | } ~</code>.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:space:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-space-character-class"></a>
-<a class="index-entry-id" id="index-space-characters"></a>
+<dt><a class="index-entry-id" id="index-space-characters"></a>
 <a class="index-entry-id" id="index-whitespace-characters"></a>
-<p>Space characters: in the &lsquo;<samp class="samp">C</samp>&rsquo; locale, 
this is
+<a id="index-space-character-class"></a><span>&lsquo;<samp 
class="samp">[:space:]</samp>&rsquo;<a class="copiable-link" 
href="#index-space-character-class"> &para;</a></span></dt>
+<dd><p>Space characters: in the &lsquo;<samp class="samp">C</samp>&rsquo; 
locale, this is
 tab, newline, vertical tab, form feed, carriage return, and space.
 See <a class="xref" href="#Usage">Usage</a>, for more discussion of matching 
newlines.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:upper:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-upper-character-class"></a>
-<a class="index-entry-id" id="index-upper_002dcase-letters"></a>
-<p>Upper-case letters: in the &lsquo;<samp class="samp">C</samp>&rsquo; locale 
and ASCII character
+<dt><a class="index-entry-id" id="index-upper_002dcase-letters"></a>
+<a id="index-upper-character-class"></a><span>&lsquo;<samp 
class="samp">[:upper:]</samp>&rsquo;<a class="copiable-link" 
href="#index-upper-character-class"> &para;</a></span></dt>
+<dd><p>Upper-case letters: in the &lsquo;<samp class="samp">C</samp>&rsquo; 
locale and ASCII character
 encoding, this is
 <code class="code">A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</code>.
 </p>
 </dd>
-<dt>&lsquo;<samp class="samp">[:xdigit:]</samp>&rsquo;</dt>
-<dd><a class="index-entry-id" id="index-xdigit-character-class"></a>
-<a class="index-entry-id" id="index-xdigit-class"></a>
+<dt><a class="index-entry-id" id="index-xdigit-class"></a>
 <a class="index-entry-id" id="index-hexadecimal-digits"></a>
-<p>Hexadecimal digits:
+<a id="index-xdigit-character-class"></a><span>&lsquo;<samp 
class="samp">[:xdigit:]</samp>&rsquo;<a class="copiable-link" 
href="#index-xdigit-character-class"> &para;</a></span></dt>
+<dd><p>Hexadecimal digits:
 <code class="code">0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f</code>.
 </p>
 </dd>
@@ -1960,8 +1917,9 @@
 locales &lsquo;<samp class="samp">[a-z]</samp>&rsquo; might match some 
characters that are not
 lowercase letters, or might not match some lowercase letters, or might
 be invalid.  With GNU <code class="command">grep</code> it is not documented 
whether
-these range expressions use native code points, or use the collating
-sequence specified by the <code class="env">LC_COLLATE</code> category, or 
have some
+these range expressions use native code points, or use the collation
+sequence specified by the <code class="env">LC_COLLATE</code> category, or use 
the
+collation ordering used by <code class="command">sort</code> and <code 
class="code">strcoll</code>, or have some
 other interpretation.  Outside the POSIX locale, it is portable to use
 &lsquo;<samp class="samp">[[:lower:]]</samp>&rsquo; to match a lower-case 
letter, or
 &lsquo;<samp class="samp">[abcdefghijklmnopqrstuvwxyz]</samp>&rsquo; to match 
an ASCII lower-case
@@ -2229,7 +2187,7 @@
 <code class="command">grep</code> does not have any limit on the length of a 
line
 except the available memory.
 </p>
-</li><li> Why does <code class="command">grep</code> report &ldquo;Binary file 
matches&rdquo;?
+</li><li> Why does <code class="command">grep</code> report &ldquo;binary file 
matches&rdquo;?
 
 <p>If <code class="command">grep</code> listed all matching 
&ldquo;lines&rdquo; from a binary file, it
 would probably generate output that is not useful, and it might even
@@ -2584,8 +2542,8 @@
 </div>
 
 <div class="display">
-<pre class="display-preformatted">Copyright &copy; 2000&ndash;2002, 
2007&ndash;2008, 2023 Free Software Foundation,
-Inc.
+<pre class="display-preformatted">Copyright &copy; 2000&ndash;2002, 
2007&ndash;2008, 2023&ndash;2025 Free Software
+Foundation, Inc.
 <a class="uref" href="https://fsf.org/";>https://fsf.org/</a>
 
 Everyone is permitted to copy and distribute verbatim copies

Reply via email to