[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to manual/grep.html
From: |
Karl Berry |
Subject: |
Changes to manual/grep.html |
Date: |
Sun, 24 May 2009 18:43:02 +0000 |
CVSROOT: /web/grep
Module name: grep
Changes by: Karl Berry <karl> 09/05/24 18:43:01
Index: manual/grep.html
===================================================================
RCS file: manual/grep.html
diff -N manual/grep.html
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ manual/grep.html 24 May 2009 18:42:55 -0000 1.1
@@ -0,0 +1,2159 @@
+<html lang="en">
+<head>
+<title>GNU Grep 2.5.4</title>
+<meta http-equiv="Content-Type" content="text/html">
+<meta name="description" content="GNU Grep 2.5.4">
+<meta name="generator" content="makeinfo 4.13">
+<link title="Top" rel="top" href="#Top">
+<link href="http://www.gnu.org/software/texinfo/"; rel="generator-home"
title="Texinfo Homepage">
+<!--
+This manual is for `grep', a pattern matching engine.
+
+Copyright (C) 1999, 2000, 2001, 2002, 2005, 2008, 2009 Free
+Software Foundation, Inc.
+
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation License,
+ Version 1.3 or any later version published by the Free Software
+ Foundation; with no 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".
+ -->
+<meta http-equiv="Content-Style-Type" content="text/css">
+<style type="text/css"><!--
+ pre.display { font-family:inherit }
+ pre.format { font-family:inherit }
+ pre.smalldisplay { font-family:inherit; font-size:smaller }
+ pre.smallformat { font-family:inherit; font-size:smaller }
+ pre.smallexample { font-size:smaller }
+ pre.smalllisp { font-size:smaller }
+ span.sc { font-variant:small-caps }
+ span.roman { font-family:serif; font-weight:normal; }
+ span.sansserif { font-family:sans-serif; font-weight:normal; }
+--></style>
+</head>
+<body>
+<h1 class="settitle">GNU Grep 2.5.4</h1>
+<div class="contents">
+<h2>Table of Contents</h2>
+<ul>
+<li><a name="toc_Top" href="#Top">grep</a>
+<li><a name="toc_Introduction" href="#Introduction">1 Introduction</a>
+<li><a name="toc_Invoking" href="#Invoking">2 Invoking <samp><span
class="command">grep</span></samp></a>
+<ul>
+<li><a href="#Command_002dline-Options">2.1 Command-line Options</a>
+<ul>
+<li><a href="#Generic-Program-Information">2.1.1 Generic Program
Information</a>
+<li><a href="#Matching-Control">2.1.2 Matching Control</a>
+<li><a href="#General-Output-Control">2.1.3 General Output Control</a>
+<li><a href="#Output-Line-Prefix-Control">2.1.4 Output Line Prefix Control</a>
+<li><a href="#Context-Line-Control">2.1.5 Context Line Control</a>
+<li><a href="#File-and-Directory-Selection">2.1.6 File and Directory
Selection</a>
+<li><a href="#Other-Options">2.1.7 Other Options</a>
+</li></ul>
+<li><a href="#Environment-Variables">2.2 Environment Variables</a>
+<li><a href="#Exit-Status">2.3 Exit Status</a>
+<li><a href="#grep-Programs">2.4 <samp><span
class="command">grep</span></samp> Programs</a>
+</li></ul>
+<li><a name="toc_Regular-Expressions" href="#Regular-Expressions">3 Regular
Expressions</a>
+<ul>
+<li><a href="#Fundamental-Structure">3.1 Fundamental Structure</a>
+<li><a href="#Character-Classes-and-Bracket-Expressions">3.2 Character Classes
and Bracket Expressions</a>
+<li><a href="#The-Backslash-Character-and-Special-Expressions">3.3 The
Backslash Character and Special Expressions</a>
+<li><a href="#Anchoring">3.4 Anchoring</a>
+<li><a href="#Back_002dreferences-and-Subexpressions">3.5 Back-references and
Subexpressions</a>
+<li><a href="#Basic-vs-Extended">3.6 Basic vs Extended Regular Expressions</a>
+</li></ul>
+<li><a name="toc_Usage" href="#Usage">4 Usage</a>
+<li><a name="toc_Reporting-Bugs" href="#Reporting-Bugs">5 Reporting bugs</a>
+<ul>
+<li><a href="#Reporting-Bugs">5.1 Known Bugs</a>
+</li></ul>
+<li><a name="toc_Copying" href="#Copying">6 Copying</a>
+<ul>
+<li><a href="#GNU-Free-Documentation-License">6.1 GNU Free Documentation
License</a>
+</li></ul>
+<li><a name="toc_Index" href="#Index">Index</a>
+</li></ul>
+</div>
+
+
+
+<div class="node">
+<a name="Top"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Introduction">Introduction</a>,
+Up: <a rel="up" accesskey="u" href="#dir">(dir)</a>
+
+</div>
+
+<h2 class="unnumbered">grep</h2>
+
+<p><samp><span class="command">grep</span></samp> prints lines that match a
pattern.
+
+ <p>This manual is for version 2.5.4 of GNU Grep.
+
+ <p>This manual is for <samp><span class="command">grep</span></samp>, a
pattern matching engine.
+
+ <p>Copyright © 1999, 2000, 2001, 2002, 2005, 2008, 2009 Free
+Software Foundation, Inc.
+
+ <blockquote>
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+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”.
+</blockquote>
+
+<ul class="menu">
+<li><a accesskey="1" href="#Introduction">Introduction</a>:
Introduction.
+<li><a accesskey="2" href="#Invoking">Invoking</a>:
Command-line options, environment, exit status.
+<li><a accesskey="3" href="#Regular-Expressions">Regular Expressions</a>:
Regular Expressions.
+<li><a accesskey="4" href="#Usage">Usage</a>: Examples.
+<li><a accesskey="5" href="#Reporting-Bugs">Reporting Bugs</a>:
Reporting Bugs.
+<li><a accesskey="6" href="#Copying">Copying</a>: License
terms for this manual.
+<li><a accesskey="7" href="#Index">Index</a>: Combined
index.
+</ul>
+
+<div class="node">
+<a name="Introduction"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Invoking">Invoking</a>,
+Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>,
+Up: <a rel="up" accesskey="u" href="#Top">Top</a>
+
+</div>
+
+<h2 class="chapter">1 Introduction</h2>
+
+<p><a name="index-searching-for-a-pattern-1"></a>
+<samp><span class="command">grep</span></samp> searches the input files
+for lines containing a match to a given pattern list.
+When it finds a match in a line,
+it copies the line to standard output (by default),
+or produces whatever other sort of output you have requested with options.
+
+ <p>Though <samp><span class="command">grep</span></samp> expects to do the
matching on text,
+it has no limits on input line length other than available memory,
+and it can match arbitrary characters within a line.
+If the final byte of an input file is not a newline,
+<samp><span class="command">grep</span></samp> silently supplies one.
+Since newline is also a separator for the list of patterns,
+there is no way to match newline characters in a text.
+
+<div class="node">
+<a name="Invoking"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Regular-Expressions">Regular
Expressions</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Introduction">Introduction</a>,
+Up: <a rel="up" accesskey="u" href="#Top">Top</a>
+
+</div>
+
+<h2 class="chapter">2 Invoking <samp><span
class="command">grep</span></samp></h2>
+
+<p>The general synopsis of the <samp><span class="command">grep</span></samp>
command line is
+
+<pre class="example"> grep <var>options</var> <var>pattern</var>
<var>input_file_names</var>
+</pre>
+ <p class="noindent">There can be zero or more <var>options</var>.
+<var>pattern</var> will only be seen as such
+(and not as an <var>input_file_name</var>)
+if it wasn't already specified within <var>options</var>
+(by using the ‘<samp><span class="samp">-e
</span><var>pattern</var></samp>’
+or ‘<samp><span class="samp">-f </span><var>file</var></samp>’
options).
+There can be zero or more <var>input_file_names</var>.
+
+<ul class="menu">
+<li><a accesskey="1" href="#Command_002dline-Options">Command-line
Options</a>: Short and long names, grouped by category.
+<li><a accesskey="2" href="#Environment-Variables">Environment Variables</a>:
POSIX, GNU generic, and GNU grep specific.
+<li><a accesskey="3" href="#Exit-Status">Exit Status</a>:
Exit status returned by <samp><span class="command">grep</span></samp>.
+<li><a accesskey="4" href="#grep-Programs">grep Programs</a>:
<samp><span class="command">grep</span></samp> programs.
+</ul>
+
+<div class="node">
+<a name="Command-line-Options"></a>
+<a name="Command_002dline-Options"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n"
href="#Environment-Variables">Environment Variables</a>,
+Up: <a rel="up" accesskey="u" href="#Invoking">Invoking</a>
+
+</div>
+
+<h3 class="section">2.1 Command-line Options</h3>
+
+<p><samp><span class="command">grep</span></samp> comes with a rich set of
options:
+some from <span class="sc">posix.2</span> and some being <span
class="sc">gnu</span> extensions.
+Long option names are always a <span class="sc">gnu</span> extension,
+even for options that are from <span class="sc">posix</span> specifications.
+Options that are specified by <span class="sc">posix</span>,
+under their short names,
+are explicitly marked as such
+to facilitate <span class="sc">posix</span>-portable programming.
+A few option names are provided
+for compatibility with older or more exotic implementations.
+
+<ul class="menu">
+<li><a accesskey="1" href="#Generic-Program-Information">Generic Program
Information</a>
+<li><a accesskey="2" href="#Matching-Control">Matching Control</a>
+<li><a accesskey="3" href="#General-Output-Control">General Output Control</a>
+<li><a accesskey="4" href="#Output-Line-Prefix-Control">Output Line Prefix
Control</a>
+<li><a accesskey="5" href="#Context-Line-Control">Context Line Control</a>
+<li><a accesskey="6" href="#File-and-Directory-Selection">File and Directory
Selection</a>
+<li><a accesskey="7" href="#Other-Options">Other Options</a>
+</ul>
+
+ <p>Several additional options control
+which variant of the <samp><span class="command">grep</span></samp> matching
engine is used.
+See <a href="#grep-Programs">grep Programs</a>.
+
+<div class="node">
+<a name="Generic-Program-Information"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Matching-Control">Matching
Control</a>,
+Up: <a rel="up" accesskey="u"
href="#Command_002dline-Options">Command-line Options</a>
+
+</div>
+
+<h4 class="subsection">2.1.1 Generic Program Information</h4>
+
+ <dl>
+<dt>‘<samp><span class="samp">--help</span></samp>’<dd><a
name="index-g_t_002d_002dhelp-2"></a><a
name="index-usage-summary_002c-printing-3"></a>Print a usage message briefly
summarizing the command-line options
+and the bug-reporting address, then exit.
+
+ <br><dt>‘<samp><span
class="samp">-V</span></samp>’<dt>‘<samp><span
class="samp">--version</span></samp>’<dd><a
name="index-g_t_002dV-4"></a><a name="index-g_t_002d_002dversion-5"></a><a
name="index-version_002c-printing-6"></a>Print the version number of
<samp><span class="command">grep</span></samp> to the standard output stream.
+This version number should be included in all bug reports.
+
+</dl>
+
+<div class="node">
+<a name="Matching-Control"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#General-Output-Control">General
Output Control</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Generic-Program-Information">Generic Program Information</a>,
+Up: <a rel="up" accesskey="u"
href="#Command_002dline-Options">Command-line Options</a>
+
+</div>
+
+<h4 class="subsection">2.1.2 Matching Control</h4>
+
+ <dl>
+<dt>‘<samp><span class="samp">-e
</span><var>pattern</var></samp>’<dt>‘<samp><span
class="samp">--regexp=</span><var>pattern</var></samp>’<dd><a
name="index-g_t_002de-7"></a><a
name="index-g_t_002d_002dregexp_003d_0040var_007bpattern_007d-8"></a><a
name="index-pattern-list-9"></a>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><span
class="samp">-</span></samp>’.
+(‘<samp><span class="samp">-e</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span class="samp">-f
</span><var>file</var></samp>’<dt>‘<samp><span
class="samp">--file=</span><var>file</var></samp>’<dd><a
name="index-g_t_002df-10"></a><a name="index-g_t_002d_002dfile-11"></a><a
name="index-pattern-from-file-12"></a>Obtain patterns from <var>file</var>, one
per line.
+The empty file contains zero patterns, and therefore matches nothing.
+(‘<samp><span class="samp">-f</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">-i</span></samp>’<dt>‘<samp><span
class="samp">-y</span></samp>’<dt>‘<samp><span
class="samp">--ignore-case</span></samp>’<dd><a
name="index-g_t_002di-13"></a><a name="index-g_t_002dy-14"></a><a
name="index-g_t_002d_002dignore_002dcase-15"></a><a
name="index-case-insensitive-search-16"></a>Ignore case distinctions in both
the pattern and the input files.
+‘<samp><span class="samp">-y</span></samp>’ is an obsolete synonym
that is provided for compatibility.
+(‘<samp><span class="samp">-i</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">-v</span></samp>’<dt>‘<samp><span
class="samp">--invert-match</span></samp>’<dd><a
name="index-g_t_002dv-17"></a><a
name="index-g_t_002d_002dinvert_002dmatch-18"></a><a
name="index-invert-matching-19"></a><a
name="index-print-non_002dmatching-lines-20"></a>Invert the sense of matching,
to select non-matching lines.
+(‘<samp><span class="samp">-v</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">-w</span></samp>’<dt>‘<samp><span
class="samp">--word-regexp</span></samp>’<dd><a
name="index-g_t_002dw-21"></a><a
name="index-g_t_002d_002dword_002dregexp-22"></a><a
name="index-matching-whole-words-23"></a>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.
+Similarly,
+it must be either at the end of the line
+or followed by a non-word constituent character.
+Word-constituent characters are letters, digits, and the underscore.
+
+ <br><dt>‘<samp><span
class="samp">-x</span></samp>’<dt>‘<samp><span
class="samp">--line-regexp</span></samp>’<dd><a
name="index-g_t_002dx-24"></a><a
name="index-g_t_002d_002dline_002dregexp-25"></a><a
name="index-match-the-whole-line-26"></a>Select only those matches that exactly
match the whole line.
+(‘<samp><span class="samp">-x</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+</dl>
+
+<div class="node">
+<a name="General-Output-Control"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n"
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Matching-Control">Matching Control</a>,
+Up: <a rel="up" accesskey="u"
href="#Command_002dline-Options">Command-line Options</a>
+
+</div>
+
+<h4 class="subsection">2.1.3 General Output Control</h4>
+
+ <dl>
+<dt>‘<samp><span
class="samp">-c</span></samp>’<dt>‘<samp><span
class="samp">--count</span></samp>’<dd><a
name="index-g_t_002dc-27"></a><a name="index-g_t_002d_002dcount-28"></a><a
name="index-counting-lines-29"></a>Suppress normal output;
+instead print a count of matching lines for each input file.
+With the ‘<samp><span class="samp">-v</span></samp>’,
‘<samp><span class="samp">--invert-match</span></samp>’ option,
+count non-matching lines.
+(‘<samp><span class="samp">-c</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">--color[=</span><var>WHEN</var><span
class="samp">]</span></samp>’<dt>‘<samp><span
class="samp">--colour[=</span><var>WHEN</var><span
class="samp">]</span></samp>’<dd><a
name="index-g_t_002d_002dcolor-30"></a><a
name="index-g_t_002d_002dcolour-31"></a><a
name="index-highlight_002c-color_002c-colour-32"></a>Surround the 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.
+The colors are defined by the environment variable <var>GREP_COLORS</var>
+and default to ‘<samp><span
class="samp">ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36</span></samp>’
+for bold red matched text, magenta file names, green line numbers,
+green byte offsets, cyan separators, and default terminal colors otherwise.
+The deprecated environment variable <var>GREP_COLOR</var> is still supported,
+but its setting does not have priority;
+it defaults to `01;31' (bold red)
+which only covers the color for matched text.
+<var>WHEN</var> is ‘<samp><span class="samp">never</span></samp>’,
‘<samp><span class="samp">always</span></samp>’, or
‘<samp><span class="samp">auto</span></samp>’.
+
+ <br><dt>‘<samp><span
class="samp">-L</span></samp>’<dt>‘<samp><span
class="samp">--files-without-match</span></samp>’<dd><a
name="index-g_t_002dL-33"></a><a
name="index-g_t_002d_002dfiles_002dwithout_002dmatch-34"></a><a
name="index-files-which-don_0027t-match-35"></a>Suppress normal output;
+instead print the name of each input file from which
+no output would normally have been printed.
+The scanning of every file will stop on the first match.
+
+ <br><dt>‘<samp><span
class="samp">-l</span></samp>’<dt>‘<samp><span
class="samp">--files-with-matches</span></samp>’<dd><a
name="index-g_t_002dl-36"></a><a
name="index-g_t_002d_002dfiles_002dwith_002dmatches-37"></a><a
name="index-names-of-matching-files-38"></a>Suppress normal output;
+instead print the name of each input file from which
+output would normally have been printed.
+The scanning of every file will stop on the first match.
+(‘<samp><span class="samp">-l</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span class="samp">-m
</span><var>num</var></samp>’<dt>‘<samp><span
class="samp">--max-count=</span><var>num</var></samp>’<dd><a
name="index-g_t_002dm-39"></a><a
name="index-g_t_002d_002dmax_002dcount-40"></a><a
name="index-max_002dcount-41"></a>Stop reading a file after <var>num</var>
matching lines.
+If the input is standard input from a regular file,
+and <var>num</var> matching lines are output,
+<samp><span class="command">grep</span></samp> ensures that the standard input
is positioned
+just after the last matching line before exiting,
+regardless of the presence of trailing context lines.
+This enables a calling process to resume a search.
+For example, the following shell script makes use of it:
+
+ <pre class="example"> while grep -m 1 PATTERN
+ do
+ echo xxxx
+ done < FILE
+</pre>
+ <p>But the following probably will not work because a pipe is not a
regular
+file:
+
+ <pre class="example"> # This probably will not work.
+ cat FILE |
+ while grep -m 1 PATTERN
+ do
+ echo xxxx
+ done
+</pre>
+ <p>When <samp><span class="command">grep</span></samp> stops after
<var>num</var> matching lines,
+it outputs any trailing context lines.
+Since context does not include matching lines,
+<samp><span class="command">grep</span></samp> will stop when it encounters
another matching line.
+When the ‘<samp><span class="samp">-c</span></samp>’ or
‘<samp><span class="samp">--count</span></samp>’ option is also
used,
+<samp><span class="command">grep</span></samp> does not output a count greater
than <var>num</var>.
+When the ‘<samp><span class="samp">-v</span></samp>’ or
‘<samp><span class="samp">--invert-match</span></samp>’ option is
also used,
+<samp><span class="command">grep</span></samp> stops after outputting
<var>num</var> non-matching lines.
+
+ <br><dt>‘<samp><span
class="samp">-o</span></samp>’<dt>‘<samp><span
class="samp">--only-matching</span></samp>’<dd><a
name="index-g_t_002do-42"></a><a
name="index-g_t_002d_002donly_002dmatching-43"></a><a
name="index-only-matching-44"></a>Print only the matched (non-empty) parts of
matching lines,
+with each such part on a separate output line.
+
+ <br><dt>‘<samp><span
class="samp">-q</span></samp>’<dt>‘<samp><span
class="samp">--quiet</span></samp>’<dt>‘<samp><span
class="samp">--silent</span></samp>’<dd><a
name="index-g_t_002dq-45"></a><a name="index-g_t_002d_002dquiet-46"></a><a
name="index-g_t_002d_002dsilent-47"></a><a
name="index-quiet_002c-silent-48"></a>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><span class="samp">-s</span></samp>’ or
‘<samp><span class="samp">--no-messages</span></samp>’ option.
+(‘<samp><span class="samp">-q</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">-s</span></samp>’<dt>‘<samp><span
class="samp">--no-messages</span></samp>’<dd><a
name="index-g_t_002ds-49"></a><a
name="index-g_t_002d_002dno_002dmessages-50"></a><a
name="index-suppress-error-messages-51"></a>Suppress error messages about
nonexistent or unreadable files.
+Portability note:
+unlike <span class="sc">gnu</span> <samp><span
class="command">grep</span></samp>,
+7th Edition Unix <samp><span class="command">grep</span></samp> did not
conform to <span class="sc">posix</span>,
+because it lacked ‘<samp><span class="samp">-q</span></samp>’
+and its ‘<samp><span class="samp">-s</span></samp>’ option behaved
like
+<span class="sc">gnu</span> <samp><span class="command">grep</span></samp>'s
‘<samp><span class="samp">-q</span></samp>’ option.
+<span class="sc">usg</span>-style <samp><span
class="command">grep</span></samp> also lacked ‘<samp><span
class="samp">-q</span></samp>’
+but its ‘<samp><span class="samp">-s</span></samp>’ option behaved
like <span class="sc">gnu</span> <samp><span
class="command">grep</span></samp>'s.
+Portable shell scripts should avoid both
+‘<samp><span class="samp">-q</span></samp>’ and ‘<samp><span
class="samp">-s</span></samp>’ and should redirect
+standard and error output to <samp><span class="file">/dev/null</span></samp>
instead.
+(‘<samp><span class="samp">-s</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+</dl>
+
+<div class="node">
+<a name="Output-Line-Prefix-Control"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Context-Line-Control">Context
Line Control</a>,
+Previous: <a rel="previous" accesskey="p"
href="#General-Output-Control">General Output Control</a>,
+Up: <a rel="up" accesskey="u"
href="#Command_002dline-Options">Command-line Options</a>
+
+</div>
+
+<h4 class="subsection">2.1.4 Output Line Prefix Control</h4>
+
+<p>When several prefix fields are to be output,
+the order is always file name, line number, and byte offset,
+regardless of the order in which these options were specified.
+
+ <dl>
+<dt>‘<samp><span
class="samp">-b</span></samp>’<dt>‘<samp><span
class="samp">--byte-offset</span></samp>’<dd><a
name="index-g_t_002db-52"></a><a
name="index-g_t_002d_002dbyte_002doffset-53"></a><a
name="index-byte-offset-54"></a>Print the 0-based byte offset within the input
file
+before each line of output.
+If ‘<samp><span class="samp">-o</span></samp>’ (‘<samp><span
class="samp">--only-matching</span></samp>’) is specified,
+print the offset of the matching part itself.
+When <samp><span class="command">grep</span></samp> runs on <span
class="sc">ms-dos</span> or <span class="sc">ms</span>-Windows,
+the printed byte offsets depend on whether
+the ‘<samp><span class="samp">-u</span></samp>’
(‘<samp><span class="samp">--unix-byte-offsets</span></samp>’)
option is used;
+see below.
+
+ <br><dt>‘<samp><span
class="samp">-H</span></samp>’<dt>‘<samp><span
class="samp">--with-filename</span></samp>’<dd><a
name="index-g_t_002dH-55"></a><a
name="index-g_t_002d_002dwith_002dfilename-56"></a><a
name="index-with-filename-prefix-57"></a>Print the file name for each match.
+This is the default when there is more than one file to search.
+
+ <br><dt>‘<samp><span
class="samp">-h</span></samp>’<dt>‘<samp><span
class="samp">--no-filename</span></samp>’<dd><a
name="index-g_t_002dh-58"></a><a
name="index-g_t_002d_002dno_002dfilename-59"></a><a
name="index-no-filename-prefix-60"></a>Suppress the prefixing of file names on
output.
+This is the default when there is only one file
+(or only standard input) to search.
+
+ <br><dt>‘<samp><span
class="samp">--label=</span><var>LABEL</var></samp>’<dd><a
name="index-g_t_002d_002dlabel-61"></a><a
name="index-changing-name-of-standard-input-62"></a>Display input actually
coming from standard input
+as input coming from file <var>LABEL</var>.
+This is especially useful for tools like <samp><span
class="command">zgrep</span></samp>;
+e.g.:
+
+ <pre class="example"> gzip -cd foo.gz | grep --label=foo
something
+</pre>
+ <br><dt>‘<samp><span
class="samp">-n</span></samp>’<dt>‘<samp><span
class="samp">--line-number</span></samp>’<dd><a
name="index-g_t_002dn-63"></a><a
name="index-g_t_002d_002dline_002dnumber-64"></a><a
name="index-line-numbering-65"></a>Prefix each line of output with the 1-based
line number within its input file.
+(‘<samp><span class="samp">-n</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">-T</span></samp>’<dt>‘<samp><span
class="samp">--initial-tab</span></samp>’<dd><a
name="index-g_t_002dT-66"></a><a
name="index-g_t_002d_002dinitial_002dtab-67"></a><a
name="index-tab_002daligned-content-lines-68"></a>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><span class="samp">-H</span></samp>’, ‘<samp><span
class="samp">-n</span></samp>’, and ‘<samp><span
class="samp">-b</span></samp>’.
+In order to improve the probability that lines
+from a single file will all start at the same column,
+this also causes the line number and byte offset (if present)
+to be printed in a minimum-size field width.
+
+ <br><dt>‘<samp><span
class="samp">-u</span></samp>’<dt>‘<samp><span
class="samp">--unix-byte-offsets</span></samp>’<dd><a
name="index-g_t_002du-69"></a><a
name="index-g_t_002d_002dunix_002dbyte_002doffsets-70"></a><a
name="index-g_t_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-byte-offsets-71"></a><a
name="index-byte-offsets_002c-on-_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-72"></a>Report
Unix-style byte offsets.
+This option causes <samp><span class="command">grep</span></samp> to report
byte offsets
+as if the file were a Unix-style text file,
+i.e., the byte offsets ignore the <code>CR</code> characters that were
stripped.
+This will produce results identical
+to running <samp><span class="command">grep</span></samp> on a Unix machine.
+This option has no effect unless the ‘<samp><span
class="samp">-b</span></samp>’ option is also used;
+it has no effect on platforms other than <span class="sc">ms-dos</span> and
<span class="sc">ms</span>-Windows.
+
+ <br><dt>‘<samp><span
class="samp">-Z</span></samp>’<dt>‘<samp><span
class="samp">--null</span></samp>’<dd><a name="index-g_t_002dZ-73"></a><a
name="index-g_t_002d_002dnull-74"></a><a
name="index-zero_002dterminated-file-names-75"></a>Output a zero byte (the
<span class="sc">ascii</span> <code>NUL</code> character)
+instead of the character that normally follows a file name.
+For example,
+‘<samp><span class="samp">grep -lZ</span></samp>’ outputs a zero
byte after each file name
+instead of the usual newline.
+This option makes the output unambiguous,
+even in the presence of file names containing unusual characters like
newlines.
+This option can be used with commands like
+‘<samp><span class="samp">find -print0</span></samp>’,
‘<samp><span class="samp">perl -0</span></samp>’,
‘<samp><span class="samp">sort -z</span></samp>’, and
‘<samp><span class="samp">xargs -0</span></samp>’
+to process arbitrary file names,
+even those that contain newline characters.
+
+ </dl>
+
+<div class="node">
+<a name="Context-Line-Control"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n"
href="#File-and-Directory-Selection">File and Directory Selection</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a>,
+Up: <a rel="up" accesskey="u"
href="#Command_002dline-Options">Command-line Options</a>
+
+</div>
+
+<h4 class="subsection">2.1.5 Context Line Control</h4>
+
+<p>Regardless of how these options are set,
+<samp><span class="command">grep</span></samp> will never print any given line
more than once.
+If the ‘<samp><span class="samp">-o</span></samp>’ or
‘<samp><span class="samp">--only-matching</span></samp>’ option is
specified,
+these options have no effect and a warning is given upon their use.
+
+ <dl>
+<dt>‘<samp><span class="samp">-A
</span><var>num</var></samp>’<dt>‘<samp><span
class="samp">--after-context=</span><var>num</var></samp>’<dd><a
name="index-g_t_002dA-76"></a><a
name="index-g_t_002d_002dafter_002dcontext-77"></a><a
name="index-after-context-78"></a><a
name="index-context-lines_002c-after-match-79"></a>Print <var>num</var> lines
of trailing context after matching lines.
+
+ <br><dt>‘<samp><span class="samp">-B
</span><var>num</var></samp>’<dt>‘<samp><span
class="samp">--before-context=</span><var>num</var></samp>’<dd><a
name="index-g_t_002dB-80"></a><a
name="index-g_t_002d_002dbefore_002dcontext-81"></a><a
name="index-before-context-82"></a><a
name="index-context-lines_002c-before-match-83"></a>Print <var>num</var> lines
of leading context before matching lines.
+
+ <br><dt>‘<samp><span class="samp">-C
</span><var>num</var></samp>’<dt>‘<samp><span
class="samp">-</span><var>num</var></samp>’<dt>‘<samp><span
class="samp">--context=</span><var>num</var></samp>’<dd><a
name="index-g_t_002dC-84"></a><a name="index-g_t_002d_002dcontext-85"></a><a
name="index-g_t_002d_0040var_007bnum_007d-86"></a><a
name="index-context-87"></a>Print <var>num</var> lines of leading and trailing
output context.
+
+ </dl>
+
+ <p>Matching lines normally use ‘<samp><span
class="samp">:</span></samp>’ as a separator
+between prefix fields and actual line content.
+Context (i.e., non-matching) lines use ‘<samp><span
class="samp">-</span></samp>’ instead.
+When no context is specified,
+matching lines are simply output one right after another.
+When nonzero context is specified,
+lines that are adjacent in the input form a group
+and are output one right after another,
+but disjoint groups of lines are separated by a ‘<samp><span
class="samp">--</span></samp>’
+without any prefix and on a line of its own.
+Each group may contain several matching lines
+when they are close enough to each other
+that two otherwise adjacent but divided groups connect
+and can just merge into a single contiguous one.
+
+<div class="node">
+<a name="File-and-Directory-Selection"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Other-Options">Other Options</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Context-Line-Control">Context Line Control</a>,
+Up: <a rel="up" accesskey="u"
href="#Command_002dline-Options">Command-line Options</a>
+
+</div>
+
+<h4 class="subsection">2.1.6 File and Directory Selection</h4>
+
+ <dl>
+<dt>‘<samp><span
class="samp">-a</span></samp>’<dt>‘<samp><span
class="samp">--text</span></samp>’<dd><a name="index-g_t_002da-88"></a><a
name="index-g_t_002d_002dtext-89"></a><a
name="index-suppress-binary-data-90"></a><a
name="index-binary-files-91"></a>Process a binary file as if it were text;
+this is equivalent to the ‘<samp><span
class="samp">--binary-files=text</span></samp>’ option.
+
+ <dt>‘<samp><span
class="samp">--binary-files=</span><var>type</var></samp>’<dd><a
name="index-g_t_002d_002dbinary_002dfiles-92"></a><a
name="index-binary-files-93"></a>If the first few bytes of a file indicate that
the file contains binary data,
+assume that the file is of type <var>type</var>.
+By default, <var>type</var> is ‘<samp><span
class="samp">binary</span></samp>’,
+and <samp><span class="command">grep</span></samp> normally outputs either
+a one-line message saying that a binary file matches,
+or no message if there is no match.
+If <var>type</var> is ‘<samp><span
class="samp">without-match</span></samp>’,
+<samp><span class="command">grep</span></samp> assumes that a binary file does
not match;
+this is equivalent to the ‘<samp><span
class="samp">-I</span></samp>’ option.
+If <var>type</var> is ‘<samp><span
class="samp">text</span></samp>’,
+<samp><span class="command">grep</span></samp> processes a binary file as if
it were text;
+this is equivalent to the ‘<samp><span
class="samp">-a</span></samp>’ option.
+<em>Warning:</em> ‘<samp><span
class="samp">--binary-files=text</span></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.
+
+ <br><dt>‘<samp><span class="samp">-D
</span><var>action</var></samp>’<dt>‘<samp><span
class="samp">--devices=</span><var>action</var></samp>’<dd><a
name="index-g_t_002dD-94"></a><a name="index-g_t_002d_002ddevices-95"></a><a
name="index-device-search-96"></a>If an input file is a device, FIFO, or
socket, use <var>action</var> to process it.
+By default, <var>action</var> is ‘<samp><span
class="samp">read</span></samp>’,
+which means that devices are read just as if they were ordinary files.
+If <var>action</var> is ‘<samp><span
class="samp">skip</span></samp>’,
+devices, FIFOs, and sockets are silently skipped.
+
+ <br><dt>‘<samp><span class="samp">-d
</span><var>action</var></samp>’<dt>‘<samp><span
class="samp">--directories=</span><var>action</var></samp>’<dd><a
name="index-g_t_002dd-97"></a><a
name="index-g_t_002d_002ddirectories-98"></a><a
name="index-directory-search-99"></a>If an input file is a directory, use
<var>action</var> to process it.
+By default, <var>action</var> is ‘<samp><span
class="samp">read</span></samp>’,
+which means that directories are read just as if they were ordinary files
+(some operating systems and file systems disallow this,
+and will cause <samp><span class="command">grep</span></samp>
+to print error messages for every directory or silently skip them).
+If <var>action</var> is ‘<samp><span
class="samp">skip</span></samp>’, directories are silently skipped.
+If <var>action</var> is ‘<samp><span
class="samp">recurse</span></samp>’,
+<samp><span class="command">grep</span></samp> reads all files under each
directory, recursively;
+this is equivalent to the ‘<samp><span
class="samp">-r</span></samp>’ option.
+
+ <br><dt>‘<samp><span
class="samp">--exclude=</span><var>glob</var></samp>’<dd><a
name="index-g_t_002d_002dexclude-100"></a><a
name="index-exclude-files-101"></a><a
name="index-searching-directory-trees-102"></a>Skip files whose base name
matches <var>glob</var>
+(using wildcard matching).
+A file-name glob can use
+‘<samp><span class="samp">*</span></samp>’, ‘<samp><span
class="samp">?</span></samp>’, and ‘<samp><span
class="samp">[</span></samp>’...‘<samp><span
class="samp">]</span></samp>’ as wildcards,
+and <code>\</code> to quote a wildcard or backslash character literally.
+
+ <br><dt>‘<samp><span
class="samp">--exclude-from=</span><var>file</var></samp>’<dd><a
name="index-g_t_002d_002dexclude_002dfrom-103"></a><a
name="index-exclude-files-104"></a><a
name="index-searching-directory-trees-105"></a>Skip files whose base name
matches any of the file-name globs
+read from <var>file</var> (using wildcard matching as described
+under ‘<samp><span class="samp">--exclude</span></samp>’).
+
+ <br><dt>‘<samp><span
class="samp">--exclude-dir=</span><var>dir</var></samp>’<dd><a
name="index-g_t_002d_002dexclude_002ddir-106"></a><a
name="index-exclude-directories-107"></a>Exclude directories matching the
pattern <var>dir</var> from recursive
+directory searches.
+
+ <br><dt>‘<samp><span
class="samp">-I</span></samp>’<dd>Process a binary file as if it did not
contain matching data;
+this is equivalent to the ‘<samp><span
class="samp">--binary-files=without-match</span></samp>’ option.
+
+ <br><dt>‘<samp><span
class="samp">--include=</span><var>glob</var></samp>’<dd><a
name="index-g_t_002d_002dinclude-108"></a><a
name="index-include-files-109"></a><a
name="index-searching-directory-trees-110"></a>Search only files whose base
name matches <var>glob</var>
+(using wildcard matching as described under ‘<samp><span
class="samp">--exclude</span></samp>’).
+
+ <br><dt>‘<samp><span
class="samp">-r</span></samp>’<dt>‘<samp><span
class="samp">-R</span></samp>’<dt>‘<samp><span
class="samp">--recursive</span></samp>’<dd><a
name="index-g_t_002dr-111"></a><a
name="index-g_t_002d_002drecursive-112"></a><a
name="index-recursive-search-113"></a><a
name="index-searching-directory-trees-114"></a>For each directory mentioned on
the command line,
+read and process all files in that directory, recursively.
+This is the same as the ‘<samp><span
class="samp">--directories=recurse</span></samp>’ option.
+
+</dl>
+
+<div class="node">
+<a name="Other-Options"></a>
+<p><hr>
+Previous: <a rel="previous" accesskey="p"
href="#File-and-Directory-Selection">File and Directory Selection</a>,
+Up: <a rel="up" accesskey="u"
href="#Command_002dline-Options">Command-line Options</a>
+
+</div>
+
+<h4 class="subsection">2.1.7 Other Options</h4>
+
+ <dl>
+<dt>‘<samp><span class="samp">--line-buffered</span></samp>’<dd><a
name="index-g_t_002d_002dline_002dbuffered-115"></a><a
name="index-line-buffering-116"></a>Use line buffering on output.
+This can cause a performance penalty.
+
+ <br><dt>‘<samp><span class="samp">--mmap</span></samp>’<dd><a
name="index-g_t_002d_002dmmap-117"></a><a
name="index-memory-mapped-input-118"></a>If possible, use the <code>mmap</code>
system call to read input,
+instead of the default <code>read</code> system call.
+In some situations, ‘<samp><span
class="samp">--mmap</span></samp>’ yields better performance.
+However, ‘<samp><span class="samp">--mmap</span></samp>’ can cause
undefined behavior (including core dumps)
+if an input file shrinks while <samp><span class="command">grep</span></samp>
is operating,
+or if an I/O error occurs.
+
+ <br><dt>‘<samp><span
class="samp">-U</span></samp>’<dt>‘<samp><span
class="samp">--binary</span></samp>’<dd><a
name="index-g_t_002dU-119"></a><a name="index-g_t_002d_002dbinary-120"></a><a
name="index-g_t_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-binary-files-121"></a><a
name="index-binary-files_002c-_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-122"></a>Treat
the file(s) as binary.
+By default, under <span class="sc">ms-dos</span> and <span
class="sc">ms</span>-Windows,
+<samp><span class="command">grep</span></samp> guesses the file type
+by looking at the contents of the first 32kB read from the file.
+If <samp><span class="command">grep</span></samp> decides the file is a text
file,
+it strips the <code>CR</code> characters from the original file contents
+(to make regular expressions with <code>^</code> and <code>$</code> work
correctly).
+Specifying ‘<samp><span class="samp">-U</span></samp>’ overrules
this guesswork,
+causing all files to be read and passed to the matching mechanism verbatim;
+if the file is a text file with <code>CR/LF</code> pairs at the end of each
line,
+this will cause some regular expressions to fail.
+This option has no effect
+on platforms other than <span class="sc">ms-dos</span> and <span
class="sc">ms</span>-Windows.
+
+ <br><dt>‘<samp><span
class="samp">-z</span></samp>’<dt>‘<samp><span
class="samp">--null-data</span></samp>’<dd><a
name="index-g_t_002dz-123"></a><a
name="index-g_t_002d_002dnull_002ddata-124"></a><a
name="index-zero_002dterminated-lines-125"></a>Treat the input as a set of
lines, each terminated by a zero byte (the
+<span class="sc">ascii</span> <code>NUL</code> character) instead of a
newline.
+Like the ‘<samp><span class="samp">-Z</span></samp>’ or
‘<samp><span class="samp">--null</span></samp>’ option,
+this option can be used with commands like
+‘<samp><span class="samp">sort -z</span></samp>’ to process
arbitrary file names.
+
+</dl>
+
+<div class="node">
+<a name="Environment-Variables"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Exit-Status">Exit Status</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Command_002dline-Options">Command-line Options</a>,
+Up: <a rel="up" accesskey="u" href="#Invoking">Invoking</a>
+
+</div>
+
+<h3 class="section">2.2 Environment Variables</h3>
+
+<p>The behavior of <samp><span class="command">grep</span></samp> is affected
+by the following environment variables.
+
+ <p>The locale for category <code>LC_</code><var>foo</var><!-- /@w -->
+is specified by examining the three environment variables
+<samp><span class="env">LC_ALL</span></samp>, <samp><span
class="env">LC_</span><var>foo</var></samp><!-- /@w -->, and <samp><span
class="env">LANG</span></samp>,
+in that order.
+The first of these variables that is set specifies the locale.
+For example, if <samp><span class="env">LC_ALL</span></samp> is not set,
+but <samp><span class="env">LC_MESSAGES</span></samp> is set to
‘<samp><span class="samp">pt_BR</span></samp>’,
+then the Brazilian Portuguese locale is used
+for the <code>LC_MESSAGES</code> category.
+The ‘<samp><span class="samp">C</span></samp>’ locale is used if
none of these environment variables are set,
+if the locale catalog is not installed,
+or if <samp><span class="command">grep</span></samp> was not compiled
+with national language support (<span class="sc">nls</span>).
+
+ <p><a name="index-environment-variables-126"></a>
+ <dl>
+<dt><samp><span class="env">GREP_OPTIONS</span></samp><dd><a
name="index-GREP_005fOPTIONS-_0040r_007benvironment-variable_007d-127"></a><a
name="index-default-options-environment-variable-128"></a>This variable
specifies default options to be placed in front of any
+explicit options.
+For example, if <code>GREP_OPTIONS</code> is
+‘<samp><span class="samp">--binary-files=without-match
--directories=skip</span></samp>’, <samp><span
class="command">grep</span></samp>
+behaves as if the two options ‘<samp><span
class="samp">--binary-files=without-match</span></samp>’ and
+‘<samp><span class="samp">--directories=skip</span></samp>’ had
been specified before
+any explicit options.
+Option specifications are separated by
+whitespace.
+A backslash escapes the next character, so it can be used to
+specify an option containing whitespace or a backslash.
+
+ <br><dt><samp><span class="env">GREP_COLOR</span></samp><dd><a
name="index-GREP_005fCOLOR-_0040r_007benvironment-variable_007d-129"></a><a
name="index-highlight-markers-130"></a>This variable specifies the color used
to highlight matched (non-empty) text.
+It is deprecated in favor of <code>GREP_COLORS</code>, but still supported.
+The ‘<samp><span class="samp">mt</span></samp>’,
‘<samp><span class="samp">ms</span></samp>’, and ‘<samp><span
class="samp">mc</span></samp>’ capabilities of <code>GREP_COLORS</code>
+have priority over it.
+It can only specify the color used to highlight
+the matching non-empty text in any matching line
+(a selected line when the ‘<samp><span
class="samp">-v</span></samp>’ command-line option is omitted,
+or a context line when ‘<samp><span class="samp">-v</span></samp>’
is specified).
+The default is ‘<samp><span class="samp">01;31</span></samp>’,
+which means a bold red foreground text on the terminal's default background.
+
+ <br><dt><samp><span class="env">GREP_COLORS</span></samp><dd><a
name="index-GREP_005fCOLORS-_0040r_007benvironment-variable_007d-131"></a><a
name="index-highlight-markers-132"></a>This variable specifies the colors and
other attributes
+used to highlight various parts of the output.
+Its value is a colon-separated list of capabilities
+that defaults to ‘<samp><span
class="samp">ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36</span></samp>’
+with the ‘<samp><span class="samp">rv</span></samp>’ and
‘<samp><span class="samp">ne</span></samp>’ boolean capabilities
omitted (i.e., false).
+Supported capabilities are as follows.
+
+ <dl>
+<dt><code>sl=</code><dd><a
name="index-sl-GREP_005fCOLORS-_0040r_007bcapability_007d-133"></a>SGR
substring for whole selected lines
+(i.e.,
+matching lines when the ‘<samp><span
class="samp">-v</span></samp>’ command-line option is omitted,
+or non-matching lines when ‘<samp><span
class="samp">-v</span></samp>’ is specified).
+If however the boolean ‘<samp><span class="samp">rv</span></samp>’
capability
+and the ‘<samp><span class="samp">-v</span></samp>’ command-line
option are both specified,
+it applies to context matching lines instead.
+The default is empty (i.e., the terminal's default color pair).
+
+ <br><dt><code>cx=</code><dd><a
name="index-cx-GREP_005fCOLORS-_0040r_007bcapability_007d-134"></a>SGR
substring for whole context lines
+(i.e.,
+non-matching lines when the ‘<samp><span
class="samp">-v</span></samp>’ command-line option is omitted,
+or matching lines when ‘<samp><span class="samp">-v</span></samp>’
is specified).
+If however the boolean ‘<samp><span class="samp">rv</span></samp>’
capability
+and the ‘<samp><span class="samp">-v</span></samp>’ command-line
option are both specified,
+it applies to selected non-matching lines instead.
+The default is empty (i.e., the terminal's default color pair).
+
+ <br><dt><code>rv</code><dd><a
name="index-rv-GREP_005fCOLORS-_0040r_007bcapability_007d-135"></a>Boolean
value that reverses (swaps) the meanings of
+the ‘<samp><span class="samp">sl=</span></samp>’ and
‘<samp><span class="samp">cx=</span></samp>’ capabilities
+when the ‘<samp><span class="samp">-v</span></samp>’ command-line
option is specified.
+The default is false (i.e., the capability is omitted).
+
+ <br><dt><code>mt=01;31</code><dd><a
name="index-mt-GREP_005fCOLORS-_0040r_007bcapability_007d-136"></a>SGR
substring for matching non-empty text in any matching line
+(i.e.,
+a selected line when the ‘<samp><span
class="samp">-v</span></samp>’ command-line option is omitted,
+or a context line when ‘<samp><span class="samp">-v</span></samp>’
is specified).
+Setting this is equivalent to setting both ‘<samp><span
class="samp">ms=</span></samp>’ and ‘<samp><span
class="samp">mc=</span></samp>’
+at once to the same value.
+The default is a bold red text foreground over the current line background.
+
+ <br><dt><code>ms=01;31</code><dd><a
name="index-ms-GREP_005fCOLORS-_0040r_007bcapability_007d-137"></a>SGR
substring for matching non-empty text in a selected line.
+(This is only used when the ‘<samp><span
class="samp">-v</span></samp>’ command-line option is omitted.)
+The effect of the ‘<samp><span class="samp">sl=</span></samp>’ (or
‘<samp><span class="samp">cx=</span></samp>’ if ‘<samp><span
class="samp">rv</span></samp>’) capability
+remains active when this kicks in.
+The default is a bold red text foreground over the current line background.
+
+ <br><dt><code>mc=01;31</code><dd><a
name="index-mc-GREP_005fCOLORS-_0040r_007bcapability_007d-138"></a>SGR
substring for matching non-empty text in a context line.
+(This is only used when the ‘<samp><span
class="samp">-v</span></samp>’ command-line option is specified.)
+The effect of the ‘<samp><span class="samp">cx=</span></samp>’ (or
‘<samp><span class="samp">sl=</span></samp>’ if ‘<samp><span
class="samp">rv</span></samp>’) capability
+remains active when this kicks in.
+The default is a bold red text foreground over the current line background.
+
+ <br><dt><code>fn=35</code><dd><a
name="index-fn-GREP_005fCOLORS-_0040r_007bcapability_007d-139"></a>SGR
substring for file names prefixing any content line.
+The default is a magenta text foreground over the terminal's default
background.
+
+ <br><dt><code>ln=32</code><dd><a
name="index-ln-GREP_005fCOLORS-_0040r_007bcapability_007d-140"></a>SGR
substring for line numbers prefixing any content line.
+The default is a green text foreground over the terminal's default background.
+
+ <br><dt><code>bn=32</code><dd><a
name="index-bn-GREP_005fCOLORS-_0040r_007bcapability_007d-141"></a>SGR
substring for byte offsets prefixing any content line.
+The default is a green text foreground over the terminal's default background.
+
+ <br><dt><code>se=36</code><dd><a
name="index-fn-GREP_005fCOLORS-_0040r_007bcapability_007d-142"></a>SGR
substring for separators that are inserted
+between selected line fields (‘<samp><span
class="samp">:</span></samp>’),
+between context line fields (‘<samp><span
class="samp">-</span></samp>’),
+and between groups of adjacent lines
+when nonzero context is specified (‘<samp><span
class="samp">--</span></samp>’).
+The default is a cyan text foreground over the terminal's default background.
+
+ <br><dt><code>ne</code><dd><a
name="index-ne-GREP_005fCOLORS-_0040r_007bcapability_007d-143"></a>Boolean
value that prevents clearing to the end of line
+using Erase in Line (EL) to Right (‘<samp><span
class="samp">\33[K</span></samp>’)
+each time a colorized item ends.
+This is needed on terminals on which EL is not supported.
+It is otherwise useful on terminals
+for which the <code>back_color_erase</code>
+(<code>bce</code>) boolean terminfo capability does not apply,
+when the chosen highlight colors do not affect the background,
+or when EL is too slow or causes too much flicker.
+The default is false (i.e., the capability is omitted).
+</dl>
+
+ <p>Note that boolean capabilities have no ‘<samp><span
class="samp">=</span></samp>’... part.
+They are omitted (i.e., false) by default and become true when specified.
+
+ <p>See the Select Graphic Rendition (SGR) section
+in the documentation of your text terminal
+for permitted values and their meaning as character attributes.
+These substring values are integers in decimal representation
+and can be concatenated with semicolons.
+<samp><span class="command">grep</span></samp> takes care of assembling the
result
+into a complete SGR sequence (‘<samp><span
class="samp">\33[</span></samp>’...‘<samp><span
class="samp">m</span></samp>’).
+Common values to concatenate include
+‘<samp><span class="samp">1</span></samp>’ for bold,
+‘<samp><span class="samp">4</span></samp>’ for underline,
+‘<samp><span class="samp">5</span></samp>’ for blink,
+‘<samp><span class="samp">7</span></samp>’ for inverse,
+‘<samp><span class="samp">39</span></samp>’ for default foreground
color,
+‘<samp><span class="samp">30</span></samp>’ to ‘<samp><span
class="samp">37</span></samp>’ for foreground colors,
+‘<samp><span class="samp">90</span></samp>’ to ‘<samp><span
class="samp">97</span></samp>’ for 16-color mode foreground colors,
+‘<samp><span class="samp">38;5;0</span></samp>’ to
‘<samp><span class="samp">38;5;255</span></samp>’
+for 88-color and 256-color modes foreground colors,
+‘<samp><span class="samp">49</span></samp>’ for default background
color,
+‘<samp><span class="samp">40</span></samp>’ to ‘<samp><span
class="samp">47</span></samp>’ for background colors,
+‘<samp><span class="samp">100</span></samp>’ to ‘<samp><span
class="samp">107</span></samp>’ for 16-color mode background colors,
+and ‘<samp><span class="samp">48;5;0</span></samp>’ to
‘<samp><span class="samp">48;5;255</span></samp>’
+for 88-color and 256-color modes background colors.
+
+ <br><dt><samp><span class="env">LC_ALL</span></samp><dt><samp><span
class="env">LC_COLLATE</span></samp><dt><samp><span
class="env">LANG</span></samp><dd><a
name="index-LC_005fALL-_0040r_007benvironment-variable_007d-144"></a><a
name="index-LC_005fCOLLATE-_0040r_007benvironment-variable_007d-145"></a><a
name="index-LANG-_0040r_007benvironment-variable_007d-146"></a><a
name="index-character-type-147"></a><a
name="index-national-language-support-148"></a><a
name="index-NLS-149"></a>These variables specify the locale for the
<code>LC_COLLATE</code> category,
+which determines the collating sequence
+used to interpret range expressions like ‘<samp><span
class="samp">[a-z]</span></samp>’.
+
+ <br><dt><samp><span class="env">LC_ALL</span></samp><dt><samp><span
class="env">LC_CTYPE</span></samp><dt><samp><span
class="env">LANG</span></samp><dd><a
name="index-LC_005fALL-_0040r_007benvironment-variable_007d-150"></a><a
name="index-LC_005fCTYPE-_0040r_007benvironment-variable_007d-151"></a><a
name="index-LANG-_0040r_007benvironment-variable_007d-152"></a>These variables
specify the locale for the <code>LC_CTYPE</code> category,
+which determines the type of characters,
+e.g., which characters are whitespace.
+
+ <br><dt><samp><span class="env">LC_ALL</span></samp><dt><samp><span
class="env">LC_MESSAGES</span></samp><dt><samp><span
class="env">LANG</span></samp><dd><a
name="index-LC_005fALL-_0040r_007benvironment-variable_007d-153"></a><a
name="index-LC_005fMESSAGES-_0040r_007benvironment-variable_007d-154"></a><a
name="index-LANG-_0040r_007benvironment-variable_007d-155"></a><a
name="index-language-of-messages-156"></a><a
name="index-message-language-157"></a><a
name="index-national-language-support-158"></a><a
name="index-translation-of-message-language-159"></a>These variables specify
the locale for the <code>LC_MESSAGES</code> category,
+which determines the language that <samp><span
class="command">grep</span></samp> uses for messages.
+The default ‘<samp><span class="samp">C</span></samp>’ locale uses
American English messages.
+
+ <br><dt><samp><span class="env">POSIXLY_CORRECT</span></samp><dd><a
name="index-POSIXLY_005fCORRECT-_0040r_007benvironment-variable_007d-160"></a>If
set, <samp><span class="command">grep</span></samp> behaves as <span
class="sc">posix.2</span> requires; otherwise,
+<samp><span class="command">grep</span></samp> behaves more like other <span
class="sc">gnu</span> programs.
+<span class="sc">posix.2</span>
+requires that options that
+follow file names must be treated as file names;
+by default,
+such options are permuted to the front of the operand list
+and are treated as options.
+Also,
+<span class="sc">posix.2</span> requires that unrecognized options be
diagnosed as “illegal”,
+but since they are not really against the law the default
+is to diagnose them as “invalid”.
+<code>POSIXLY_CORRECT</code> also disables
<code>_</code><var>N</var><code>_GNU_nonoption_argv_flags_</code>,
+described below.
+
+ <br><dt><samp><span class="env">_</span><var>N</var><span
class="env">_GNU_nonoption_argv_flags_</span></samp><dd><a
name="index-g_t_005f_0040var_007bN_007d_005fGNU_005fnonoption_005fargv_005fflags_005f-_0040r_007benvironment-variable_007d-161"></a>(Here
<var>N</var> is <samp><span class="command">grep</span></samp>'s numeric
process ID.)
+If the <var>i</var>th character of this environment variable's value is
‘<samp><span class="samp">1</span></samp>’,
+do not consider the <var>i</var>th operand of <samp><span
class="command">grep</span></samp> to be an option,
+even if it appears to be one.
+A shell can put this variable in the environment for each command it runs,
+specifying which operands are the results of file name wildcard expansion
+and therefore should not be treated as options.
+This behavior is available only with the <span class="sc">gnu</span> C library,
+and only when <code>POSIXLY_CORRECT</code> is not set.
+
+ </dl>
+
+<div class="node">
+<a name="Exit-Status"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#grep-Programs">grep Programs</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Environment-Variables">Environment Variables</a>,
+Up: <a rel="up" accesskey="u" href="#Invoking">Invoking</a>
+
+</div>
+
+<h3 class="section">2.3 Exit Status</h3>
+
+<p><a name="index-exit-status-162"></a><a name="index-return-status-163"></a>
+Normally, the exit status is 0 if selected lines are found and 1 otherwise.
+But the exit status is 2 if an error occurred, unless the <samp><span
class="option">-q</span></samp> or
+<samp><span class="option">--quiet</span></samp> or <samp><span
class="option">--silent</span></samp> option is used and a selected line
+is found.
+Note, however, that <span class="sc">posix</span> only mandates,
+for programs such as <samp><span class="command">grep</span></samp>,
<samp><span class="command">cmp</span></samp>, and <samp><span
class="command">diff</span></samp>,
+that the exit status in case of error be greater than 1;
+it is therefore advisable, for the sake of portability,
+to use logic that tests for this general condition
+instead of strict equality with 2.
+
+<div class="node">
+<a name="grep-Programs"></a>
+<p><hr>
+Previous: <a rel="previous" accesskey="p" href="#Exit-Status">Exit
Status</a>,
+Up: <a rel="up" accesskey="u" href="#Invoking">Invoking</a>
+
+</div>
+
+<h3 class="section">2.4 <samp><span class="command">grep</span></samp>
Programs</h3>
+
+<p><a name="index-g_t_0040command_007bgrep_007d-programs-164"></a><a
name="index-variants-of-_0040command_007bgerp_007d-165"></a>
+<samp><span class="command">grep</span></samp> searches the named input files
+(or standard input if no files are named,
+or the file name <samp><span class="file">-</span></samp> is given)
+for lines containing a match to the given pattern.
+By default, <samp><span class="command">grep</span></samp> prints the matching
lines.
+There are four major variants of <samp><span
class="command">grep</span></samp>,
+controlled by the following options.
+
+ <dl>
+<dt>‘<samp><span
class="samp">-G</span></samp>’<dt>‘<samp><span
class="samp">--basic-regexp</span></samp>’<dd><a
name="index-g_t_002dG-166"></a><a
name="index-g_t_002d_002dbasic_002dregexp-167"></a><a
name="index-matching-basic-regular-expressions-168"></a>Interpret the pattern
as a basic regular expression (BRE).
+This is the default.
+
+ <br><dt>‘<samp><span
class="samp">-E</span></samp>’<dt>‘<samp><span
class="samp">--extended-regexp</span></samp>’<dd><a
name="index-g_t_002dE-169"></a><a
name="index-g_t_002d_002dextended_002dregexp-170"></a><a
name="index-matching-extended-regular-expressions-171"></a>Interpret the
pattern as an extended regular expression (ERE).
+(‘<samp><span class="samp">-E</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">-F</span></samp>’<dt>‘<samp><span
class="samp">--fixed-strings</span></samp>’<dd><a
name="index-g_t_002dF-172"></a><a
name="index-g_t_002d_002dfixed_002dstrings-173"></a><a
name="index-matching-fixed-strings-174"></a>Interpret the pattern as a list of
fixed strings, separated
+by newlines, any of which is to be matched.
+(‘<samp><span class="samp">-F</span></samp>’ is specified by <span
class="sc">posix</span>.)
+
+ <br><dt>‘<samp><span
class="samp">-P</span></samp>’<dt>‘<samp><span
class="samp">--perl-regexp</span></samp>’<dd><a
name="index-g_t_002dP-175"></a><a
name="index-g_t_002d_002dperl_002dregexp-176"></a><a
name="index-matching-Perl-regular-expressions-177"></a>Interpret the pattern as
a Perl regular expression.
+This is highly experimental and
+‘<samp><span class="samp">grep -P</span></samp>’ may warn of
unimplemented features.
+
+ </dl>
+
+ <p>In addition,
+two variant programs <samp><span class="command">egrep</span></samp> and
<samp><span class="command">fgrep</span></samp> are available.
+<samp><span class="command">egrep</span></samp> is the same as
‘<samp><span class="samp">grep -E</span></samp>’.
+<samp><span class="command">fgrep</span></samp> is the same as
‘<samp><span class="samp">grep -F</span></samp>’.
+Direct invocation as either
+<samp><span class="command">egrep</span></samp> or <samp><span
class="command">fgrep</span></samp> is deprecated,
+but is provided to allow historical applications
+that rely on them to run unmodified.
+
+<div class="node">
+<a name="Regular-Expressions"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Usage">Usage</a>,
+Previous: <a rel="previous" accesskey="p" href="#Invoking">Invoking</a>,
+Up: <a rel="up" accesskey="u" href="#Top">Top</a>
+
+</div>
+
+<h2 class="chapter">3 Regular Expressions</h2>
+
+<p><a name="index-regular-expressions-178"></a>
+A <dfn>regular expression</dfn> is a pattern that describes a set of strings.
+Regular expressions are constructed analogously to arithmetic expressions,
+by using various operators to combine smaller expressions.
+<samp><span class="command">grep</span></samp> understands
+two different versions of regular expression syntax:
+“basic”(BRE) and “extended”(ERE).
+In <span class="sc">gnu</span> <samp><span class="command">grep</span></samp>,
+there is no difference in available functionality using either syntax.
+In other implementations, basic regular expressions are less powerful.
+The following description applies to extended regular expressions;
+differences for basic regular expressions are summarized afterwards.
+
+<ul class="menu">
+<li><a accesskey="1" href="#Fundamental-Structure">Fundamental Structure</a>
+<li><a accesskey="2"
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a>
+<li><a accesskey="3"
href="#The-Backslash-Character-and-Special-Expressions">The Backslash Character
and Special Expressions</a>
+<li><a accesskey="4" href="#Anchoring">Anchoring</a>
+<li><a accesskey="5"
href="#Back_002dreferences-and-Subexpressions">Back-references and
Subexpressions</a>
+<li><a accesskey="6" href="#Basic-vs-Extended">Basic vs Extended</a>
+</ul>
+
+<div class="node">
+<a name="Fundamental-Structure"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n"
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a>,
+Up: <a rel="up" accesskey="u" href="#Regular-Expressions">Regular
Expressions</a>
+
+</div>
+
+<h3 class="section">3.1 Fundamental Structure</h3>
+
+<p>The fundamental building blocks are the regular expressions that match
+a single character.
+Most characters, including all letters and digits,
+are regular expressions that match themselves.
+Any meta-character
+with special meaning may be quoted by preceding it with a backslash.
+
+ <p>A regular expression may be followed by one of several
+repetition operators:
+
+ <dl>
+<dt>‘<samp><span class="samp">.</span></samp>’<dd><a
name="index-g_t_002e-179"></a><a name="index-dot-180"></a><a
name="index-period-181"></a>The period ‘<samp><span
class="samp">.</span></samp>’ matches any single character.
+
+ <br><dt>‘<samp><span class="samp">?</span></samp>’<dd><a
name="index-g_t_003f-182"></a><a name="index-question-mark-183"></a><a
name="index-match-expression-at-most-once-184"></a>The preceding item is
optional and will be matched at most once.
+
+ <br><dt>‘<samp><span class="samp">*</span></samp>’<dd><a
name="index-g_t_002a-185"></a><a name="index-asterisk-186"></a><a
name="index-match-expression-zero-or-more-times-187"></a>The preceding item
will be matched zero or more times.
+
+ <br><dt>‘<samp><span class="samp">+</span></samp>’<dd><a
name="index-g_t_002b-188"></a><a name="index-plus-sign-189"></a><a
name="index-match-expression-one-or-more-times-190"></a>The preceding item will
be matched one or more times.
+
+ <br><dt>‘<samp><span class="samp">{</span><var>n</var><span
class="samp">}</span></samp>’<dd><a
name="index-g_t_0040_007b_0040var_007bn_007d_0040_007d-191"></a><a
name="index-braces_002c-one-argument-192"></a><a
name="index-match-expression-_0040var_007bn_007d-times-193"></a>The preceding
item is matched exactly <var>n</var> times.
+
+ <br><dt>‘<samp><span class="samp">{</span><var>n</var><span
class="samp">,}</span></samp>’<dd><a
name="index-g_t_0040_007b_0040var_007bn_007d_002c_0040_007d-194"></a><a
name="index-braces_002c-second-argument-omitted-195"></a><a
name="index-match-expression-_0040var_007bn_007d-or-more-times-196"></a>The
preceding item is matched <var>n</var> or more times.
+
+ <br><dt>‘<samp><span class="samp">{,</span><var>m</var><span
class="samp">}</span></samp>’<dd><a
name="index-g_t_0040_007b_002c_0040var_007bm_007d_0040_007d-197"></a><a
name="index-braces_002c-first-argument-omitted-198"></a><a
name="index-match-expression-at-most-_0040var_007bm_007d-times-199"></a>The
preceding item is matched at most <var>m</var> times.
+
+ <br><dt>‘<samp><span class="samp">{</span><var>n</var><span
class="samp">,</span><var>m</var><span
class="samp">}</span></samp>’<dd><a
name="index-g_t_0040_007b_0040var_007bn_007d_002c_0040var_007bm_007d_0040_007d-200"></a><a
name="index-braces_002c-two-arguments-201"></a><a
name="index-match-expression-from-_0040var_007bn_007d-to-_0040var_007bm_007d-times-202"></a>The
preceding item is matched at least <var>n</var> times, but not more than
+<var>m</var> times.
+
+ </dl>
+
+ <p>Two regular expressions may be concatenated;
+the resulting regular expression
+matches any string formed by concatenating two substrings
+that respectively match the concatenated expressions.
+
+ <p>Two regular expressions may be joined by the infix operator
‘<samp><span class="samp">|</span></samp>’;
+the resulting regular expression
+matches any string matching either alternalte expression.
+
+ <p>Repetition takes precedence over concatenation,
+which in turn takes precedence over alternation.
+A whole expression may be enclosed in parentheses
+to override these precedence rules and form a subexpression.
+
+<div class="node">
+<a name="Character-Classes-and-Bracket-Expressions"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n"
href="#The-Backslash-Character-and-Special-Expressions">The Backslash Character
and Special Expressions</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Fundamental-Structure">Fundamental Structure</a>,
+Up: <a rel="up" accesskey="u" href="#Regular-Expressions">Regular
Expressions</a>
+
+</div>
+
+<h3 class="section">3.2 Character Classes and Bracket Expressions</h3>
+
+<p><a name="index-bracket-expression-203"></a><a
name="index-character-class-204"></a>A <dfn>bracket expression</dfn> is a list
of characters enclosed by ‘<samp><span
class="samp">[</span></samp>’ and
+‘<samp><span class="samp">]</span></samp>’.
+It matches any single character in that list;
+if the first character of the list is the caret ‘<samp><span
class="samp">^</span></samp>’,
+then it matches any character <strong>not</strong> in the list.
+For example, the regular expression
+‘<samp><span class="samp">[0123456789]</span></samp>’ matches any
single digit.
+
+ <p><a name="index-range-expression-205"></a>Within a bracket expression, a
<dfn>range expression</dfn> consists of two
+characters separated by a hyphen.
+It matches any single character that
+sorts between the two characters, inclusive, using the locale's
+collating sequence and character set.
+For example, in the default C
+locale, ‘<samp><span class="samp">[a-d]</span></samp>’ is
equivalent to ‘<samp><span class="samp">[abcd]</span></samp>’.
+Many locales sort
+characters in dictionary order, and in these locales ‘<samp><span
class="samp">[a-d]</span></samp>’ is
+typically not equivalent to ‘<samp><span
class="samp">[abcd]</span></samp>’;
+it might be equivalent to ‘<samp><span
class="samp">[aBbCcDd]</span></samp>’, for example.
+To obtain the traditional interpretation
+of bracket expressions, you can use the ‘<samp><span
class="samp">C</span></samp>’ locale by setting the
+<samp><span class="env">LC_ALL</span></samp> environment variable to the value
‘<samp><span class="samp">C</span></samp>’.
+
+ <p>Finally, certain named classes of characters are predefined within
+bracket expressions, as follows.
+Their interpretation depends on the <code>LC_CTYPE</code> locale;
+the interpretation below is that of the ‘<samp><span
class="samp">C</span></samp>’ locale,
+which is the default if no <code>LC_CTYPE</code> locale is specified.
+
+ <p><a name="index-classes-of-characters-206"></a><a
name="index-character-classes-207"></a>
+ <dl>
+<dt>‘<samp><span class="samp">[:alnum:]</span></samp>’<dd><a
name="index-alnum-_0040r_007bcharacter-class_007d-208"></a><a
name="index-alphanumeric-characters-209"></a>Alphanumeric characters:
+‘<samp><span class="samp">[:alpha:]</span></samp>’ and
‘<samp><span class="samp">[:digit:]</span></samp>’.
+
+ <br><dt>‘<samp><span
class="samp">[:alpha:]</span></samp>’<dd><a
name="index-alpha-_0040r_007bcharacter-class_007d-210"></a><a
name="index-alphabetic-characters-211"></a>Alphabetic characters:
+‘<samp><span class="samp">[:lower:]</span></samp>’ and
‘<samp><span class="samp">[:upper:]</span></samp>’.
+
+ <br><dt>‘<samp><span
class="samp">[:blank:]</span></samp>’<dd><a
name="index-blank-_0040r_007bcharacter-class_007d-212"></a><a
name="index-blank-characters-213"></a>Blank characters:
+space and tab.
+
+ <br><dt>‘<samp><span
class="samp">[:cntrl:]</span></samp>’<dd><a
name="index-cntrl-_0040r_007bcharacter-class_007d-214"></a><a
name="index-control-characters-215"></a>Control characters.
+In <span class="sc">ascii</span>, these characters have octal codes 000
+through 037, and 177 (<code>DEL</code>).
+In other character sets, these are
+the equivalent characters, if any.
+
+ <br><dt>‘<samp><span
class="samp">[:digit:]</span></samp>’<dd><a
name="index-digit-_0040r_007bcharacter-class_007d-216"></a><a
name="index-digit-characters-217"></a><a
name="index-numeric-characters-218"></a>Digits: <code>0 1 2 3 4 5 6 7 8
9</code>.
+
+ <br><dt>‘<samp><span
class="samp">[:graph:]</span></samp>’<dd><a
name="index-graph-_0040r_007bcharacter-class_007d-219"></a><a
name="index-graphic-characters-220"></a>Graphical characters:
+‘<samp><span class="samp">[:alnum:]</span></samp>’ and
‘<samp><span class="samp">[:punct:]</span></samp>’.
+
+ <br><dt>‘<samp><span
class="samp">[:lower:]</span></samp>’<dd><a
name="index-lower-_0040r_007bcharacter-class_007d-221"></a><a
name="index-lower_002dcase-letters-222"></a>Lower-case letters:
+<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>.
+
+ <br><dt>‘<samp><span
class="samp">[:print:]</span></samp>’<dd><a
name="index-print-_0040r_007bcharacter-class_007d-223"></a><a
name="index-printable-characters-224"></a>Printable characters:
+‘<samp><span class="samp">[:alnum:]</span></samp>’,
‘<samp><span class="samp">[:punct:]</span></samp>’, and space.
+
+ <br><dt>‘<samp><span
class="samp">[:punct:]</span></samp>’<dd><a
name="index-punct-_0040r_007bcharacter-class_007d-225"></a><a
name="index-punctuation-characters-226"></a>Punctuation characters:
+<code>! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | }
~</code>.
+
+ <br><dt>‘<samp><span
class="samp">[:space:]</span></samp>’<dd><a
name="index-space-_0040r_007bcharacter-class_007d-227"></a><a
name="index-space-characters-228"></a><a
name="index-whitespace-characters-229"></a>Space characters:
+tab, newline, vertical tab, form feed, carriage return, and space.
+
+ <br><dt>‘<samp><span
class="samp">[:upper:]</span></samp>’<dd><a
name="index-upper-_0040r_007bcharacter-class_007d-230"></a><a
name="index-upper_002dcase-letters-231"></a>Upper-case letters:
+<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>.
+
+ <br><dt>‘<samp><span
class="samp">[:xdigit:]</span></samp>’<dd><a
name="index-xdigit-_0040r_007bcharacter-class_007d-232"></a><a
name="index-xdigit-class-233"></a><a
name="index-hexadecimal-digits-234"></a>Hexadecimal digits:
+<code>0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f</code>.
+
+ </dl>
+ For example, ‘<samp><span
class="samp">[[:alnum:]]</span></samp>’ means ‘<samp><span
class="samp">[0-9A-Za-z]</span></samp>’, except the latter
+depends upon the ‘<samp><span class="samp">C</span></samp>’ locale
and the <span class="sc">ascii</span> character
+encoding, whereas the former is independent of locale and character set.
+(Note that the brackets in these class names are
+part of the symbolic names, and must be included in addition to
+the brackets delimiting the bracket expression.)
+
+ <p>Most meta-characters lose their special meaning inside bracket
expressions.
+
+ <dl>
+<dt>‘<samp><span class="samp">]</span></samp>’<dd>ends the bracket
expression if it's not the first list item.
+So, if you want to make the ‘<samp><span
class="samp">]</span></samp>’ character a list item,
+you must put it first.
+
+ <br><dt>‘<samp><span
class="samp">[.</span></samp>’<dd>represents the open collating symbol.
+
+ <br><dt>‘<samp><span
class="samp">.]</span></samp>’<dd>represents the close collating symbol.
+
+ <br><dt>‘<samp><span
class="samp">[=</span></samp>’<dd>represents the open equivalence class.
+
+ <br><dt>‘<samp><span
class="samp">=]</span></samp>’<dd>represents the close equivalence class.
+
+ <br><dt>‘<samp><span
class="samp">[:</span></samp>’<dd>represents the open character class
symbol, and should be followed by a valid character class name.
+
+ <br><dt>‘<samp><span
class="samp">:]</span></samp>’<dd>represents the close character class
symbol.
+
+ <br><dt>‘<samp><span
class="samp">-</span></samp>’<dd>represents the range if it's not first
or last in a list or the ending point
+of a range.
+
+ <br><dt>‘<samp><span
class="samp">^</span></samp>’<dd>represents the characters not in the
list.
+If you want to make the ‘<samp><span class="samp">^</span></samp>’
+character a list item, place it anywhere but first.
+
+ </dl>
+
+<div class="node">
+<a name="The-Backslash-Character-and-Special-Expressions"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Anchoring">Anchoring</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a>,
+Up: <a rel="up" accesskey="u" href="#Regular-Expressions">Regular
Expressions</a>
+
+</div>
+
+<h3 class="section">3.3 The Backslash Character and Special Expressions</h3>
+
+<p><a name="index-backslash-235"></a>
+The ‘<samp><span class="samp">\</span></samp>’ character,
+when followed by certain ordinary characters,
+takes a special meaning:
+
+ <dl>
+<dt>‘<samp><span class="samp">‘</span><samp><span
class="samp">\b</span></samp><span
class="samp">’</span></samp>’<dd>Match the empty string at the edge
of a word.
+
+ <br><dt>‘<samp><span class="samp">‘</span><samp><span
class="samp">\B</span></samp><span
class="samp">’</span></samp>’<dd>Match the empty string provided
it's not at the edge of a word.
+
+ <br><dt>‘<samp><span class="samp">‘</span><samp><span
class="samp">\<</span></samp><span
class="samp">’</span></samp>’<dd>Match the empty string at the
beginning of word.
+
+ <br><dt>‘<samp><span class="samp">‘</span><samp><span
class="samp">\></span></samp><span
class="samp">’</span></samp>’<dd>Match the empty string at the end
of word.
+
+ <br><dt>‘<samp><span class="samp">‘</span><samp><span
class="samp">\w</span></samp><span
class="samp">’</span></samp>’<dd>Match word constituent, it is a
synonym for ‘<samp><span class="samp">[[:alnum:]]</span></samp>’.
+
+ <br><dt>‘<samp><span class="samp">‘</span><samp><span
class="samp">\W</span></samp><span
class="samp">’</span></samp>’<dd>Match non-word constituent, it is
a synonym for ‘<samp><span class="samp">[^[:alnum:]]</span></samp>’.
+
+ </dl>
+
+ <p>For example, ‘<samp><span
class="samp">\brat\b</span></samp>’ matches the separate word
‘<samp><span class="samp">rat</span></samp>’,
+‘<samp><span class="samp">\Brat\B</span></samp>’ matches
‘<samp><span class="samp">crate</span></samp>’ but not
‘<samp><span class="samp">furry rat</span></samp>’.
+
+<div class="node">
+<a name="Anchoring"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n"
href="#Back_002dreferences-and-Subexpressions">Back-references and
Subexpressions</a>,
+Previous: <a rel="previous" accesskey="p"
href="#The-Backslash-Character-and-Special-Expressions">The Backslash Character
and Special Expressions</a>,
+Up: <a rel="up" accesskey="u" href="#Regular-Expressions">Regular
Expressions</a>
+
+</div>
+
+<h3 class="section">3.4 Anchoring</h3>
+
+<p><a name="index-anchoring-236"></a>
+The caret ‘<samp><span class="samp">^</span></samp>’ and the
dollar sign ‘<samp><span class="samp">$</span></samp>’ are
meta-characters that
+respectively match the empty string at the beginning and end of a line.
+
+<div class="node">
+<a name="Back-references-and-Subexpressions"></a>
+<a name="Back_002dreferences-and-Subexpressions"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Basic-vs-Extended">Basic vs
Extended</a>,
+Previous: <a rel="previous" accesskey="p" href="#Anchoring">Anchoring</a>,
+Up: <a rel="up" accesskey="u" href="#Regular-Expressions">Regular
Expressions</a>
+
+</div>
+
+<h3 class="section">3.5 Back-references and Subexpressions</h3>
+
+<p><a name="index-subexpression-237"></a><a
name="index-back_002dreference-238"></a>
+The back-reference ‘<samp><span
class="samp">\</span><var>n</var></samp>’, where <var>n</var> is a single
digit, matches
+the substring previously matched by the <var>n</var>th parenthesized
subexpression
+of the regular expression.
+For example, ‘<samp><span class="samp">(a)\1</span></samp>’
matches ‘<samp><span class="samp">aa</span></samp>’.
+When used with alternation, if the group does not participate in the match then
+the back-reference makes the whole match fail.
+For example, ‘<samp><span class="samp">a(.)|b\1</span></samp>’
+will not match ‘<samp><span class="samp">ba</span></samp>’.
+When multiple regular expressions are given with
+‘<samp><span class="samp">-e</span></samp>’ or from a file
(‘<samp><span class="samp">-f file</span></samp>’),
+back-references are local to each expression.
+
+<div class="node">
+<a name="Basic-vs-Extended"></a>
+<p><hr>
+Previous: <a rel="previous" accesskey="p"
href="#Back_002dreferences-and-Subexpressions">Back-references and
Subexpressions</a>,
+Up: <a rel="up" accesskey="u" href="#Regular-Expressions">Regular
Expressions</a>
+
+</div>
+
+<h3 class="section">3.6 Basic vs Extended Regular Expressions</h3>
+
+<p><a name="index-basic-regular-expressions-239"></a>
+In basic regular expressions the meta-characters ‘<samp><span
class="samp">?</span></samp>’, ‘<samp><span
class="samp">+</span></samp>’,
+‘<samp><span class="samp">{</span></samp>’, ‘<samp><span
class="samp">|</span></samp>’, ‘<samp><span
class="samp">(</span></samp>’, and ‘<samp><span
class="samp">)</span></samp>’ lose their special meaning;
+instead use the backslashed versions ‘<samp><span
class="samp">\?</span></samp>’, ‘<samp><span
class="samp">\+</span></samp>’, ‘<samp><span
class="samp">\{</span></samp>’,
+‘<samp><span class="samp">\|</span></samp>’, ‘<samp><span
class="samp">\(</span></samp>’, and ‘<samp><span
class="samp">\)</span></samp>’.
+
+ <p><a name="index-interval-specifications-240"></a>Traditional <samp><span
class="command">egrep</span></samp> did not support the ‘<samp><span
class="samp">{</span></samp>’ meta-character,
+and some <samp><span class="command">egrep</span></samp> implementations
support ‘<samp><span class="samp">\{</span></samp>’ instead, so
+portable scripts should avoid ‘<samp><span
class="samp">{</span></samp>’ in ‘<samp><span class="samp">grep
-E</span></samp>’ patterns and
+should use ‘<samp><span class="samp">[{]</span></samp>’ to match a
literal ‘<samp><span class="samp">{</span></samp>’.
+
+ <p><span class="sc">gnu</span> <samp><span class="command">grep
-E</span></samp> attempts to support traditional usage by
+assuming that ‘<samp><span class="samp">{</span></samp>’ is not
special if it would be the start of an
+invalid interval specification.
+For example, the command
+‘<samp><span class="samp">grep -E '{1'</span></samp>’ searches for
the two-character string ‘<samp><span class="samp">{1</span></samp>’
+instead of reporting a syntax error in the regular expression.
+<span class="sc">posix.2</span> allows this behavior as an extension, but
portable scripts
+should avoid it.
+
+<div class="node">
+<a name="Usage"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Reporting-Bugs">Reporting
Bugs</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Regular-Expressions">Regular Expressions</a>,
+Up: <a rel="up" accesskey="u" href="#Top">Top</a>
+
+</div>
+
+<h2 class="chapter">4 Usage</h2>
+
+<p><a name="index-usage_002c-examples-241"></a>Here is an example command that
invokes <span class="sc">gnu</span> <samp><span
class="command">grep</span></samp>:
+
+<pre class="example"> grep -i 'hello.*world' menu.h main.c
+</pre>
+ <p class="noindent">This lists all lines in the files <samp><span
class="file">menu.h</span></samp> and <samp><span
class="file">main.c</span></samp> that
+contain the string ‘<samp><span class="samp">hello</span></samp>’
followed by the string ‘<samp><span
class="samp">world</span></samp>’;
+this is because ‘<samp><span class="samp">.*</span></samp>’
matches zero or more characters within a line.
+See <a href="#Regular-Expressions">Regular Expressions</a>.
+The ‘<samp><span class="samp">-i</span></samp>’ option causes
<samp><span class="command">grep</span></samp>
+to ignore case, causing it to match the line ‘<samp><span
class="samp">Hello, world!</span></samp>’, which
+it would not otherwise match.
+See <a href="#Invoking">Invoking</a>, for more details about
+how to invoke <samp><span class="command">grep</span></samp>.
+
+ <p><a name="index-using-_0040command_007bgrep_007d_002c-Q_0026A-242"></a><a
name="index-FAQ-about-_0040command_007bgrep_007d-usage-243"></a>Here are some
common questions and answers about <samp><span
class="command">grep</span></samp> usage.
+
+ <ol type=1 start=1>
+
+ <li>How can I list just the names of matching files?
+
+ <pre class="example"> grep -l 'main' *.c
+</pre>
+ <p class="noindent">lists the names of all C files in the current
directory whose contents
+mention ‘<samp><span class="samp">main</span></samp>’.
+
+ <li>How do I search directories recursively?
+
+ <pre class="example"> grep -r 'hello' /home/gigi
+</pre>
+ <p class="noindent">searches for ‘<samp><span
class="samp">hello</span></samp>’ in all files
+under the <samp><span class="file">/home/gigi</span></samp> directory.
+For more control over which files are searched,
+use <samp><span class="command">find</span></samp>, <samp><span
class="command">grep</span></samp>, and <samp><span
class="command">xargs</span></samp>.
+For example, the following command searches only C files:
+
+ <pre class="example"> find /home/gigi -name '*.c' -print0 |
xargs -0r grep -H 'hello'
+</pre>
+ <p>This differs from the command:
+
+ <pre class="example"> grep -rH 'hello' *.c
+</pre>
+ <p>which merely looks for ‘<samp><span
class="samp">hello</span></samp>’ in all files in the current
+directory whose names end in ‘<samp><span
class="samp">.c</span></samp>’.
+Here the <samp><span class="option">-r</span></samp> is
+probably unnecessary, as recursion occurs only in the unlikely event
+that one of ‘<samp><span class="samp">.c</span></samp>’ files is a
directory.
+The ‘<samp><span class="samp">find ...</span></samp>’ command line
above is more similar to the command:
+
+ <pre class="example"> grep -rH --include='*.c' 'hello' /home/gigi
+</pre>
+ <li>What if a pattern has a leading ‘<samp><span
class="samp">-</span></samp>’?
+
+ <pre class="example"> grep -e '--cut here--' *
+</pre>
+ <p class="noindent">searches for all lines matching ‘<samp><span
class="samp">--cut here--</span></samp>’.
+Without ‘<samp><span class="samp">-e</span></samp>’,
+<samp><span class="command">grep</span></samp> would attempt to parse
‘<samp><span class="samp">--cut here--</span></samp>’ as a list of
+options.
+
+ <li>Suppose I want to search for a whole word, not a part of a word?
+
+ <pre class="example"> grep -w 'hello' *
+</pre>
+ <p class="noindent">searches only for instances of ‘<samp><span
class="samp">hello</span></samp>’ that are entire words;
+it does not match ‘<samp><span
class="samp">Othello</span></samp>’.
+For more control, use ‘<samp><span
class="samp">\<</span></samp>’ and
+‘<samp><span class="samp">\></span></samp>’ to match the start
and end of words.
+For example:
+
+ <pre class="example"> grep 'hello\>' *
+</pre>
+ <p class="noindent">searches only for words ending in ‘<samp><span
class="samp">hello</span></samp>’, so it matches the word
+‘<samp><span class="samp">Othello</span></samp>’.
+
+ <li>How do I output context around the matching lines?
+
+ <pre class="example"> grep -C 2 'hello' *
+</pre>
+ <p class="noindent">prints two lines of context around each matching line.
+
+ <li>How do I force <samp><span class="command">grep</span></samp> to
print the name of the file?
+
+ <p>Append <samp><span class="file">/dev/null</span></samp>:
+
+ <pre class="example"> grep 'eli' /etc/passwd /dev/null
+</pre>
+ <p>gets you:
+
+ <pre class="example"> /etc/passwd:eli:x:2098:1000:Eli
Smith:/home/eli:/bin/bash
+</pre>
+ <p>Alternatively, use ‘<samp><span
class="samp">-H</span></samp>’, which is a <span class="sc">gnu</span>
extension:
+
+ <pre class="example"> grep -H 'eli' /etc/passwd
+</pre>
+ <li>Why do people use strange regular expressions on <samp><span
class="command">ps</span></samp> output?
+
+ <pre class="example"> ps -ef | grep '[c]ron'
+</pre>
+ <p>If the pattern had been written without the square brackets, it would
+have matched not only the <samp><span class="command">ps</span></samp> output
line for <samp><span class="command">cron</span></samp>,
+but also the <samp><span class="command">ps</span></samp> output line for
<samp><span class="command">grep</span></samp>.
+Note that on some platforms,
+<samp><span class="command">ps</span></samp> limits the output to the width of
the screen;
+<samp><span class="command">grep</span></samp> does not have any limit on the
length of a line
+except the available memory.
+
+ <li>Why does <samp><span class="command">grep</span></samp> report
“Binary file matches”?
+
+ <p>If <samp><span class="command">grep</span></samp> listed all matching
“lines” from a binary file, it
+would probably generate output that is not useful, and it might even
+muck up your display.
+So <span class="sc">gnu</span> <samp><span class="command">grep</span></samp>
suppresses output from
+files that appear to be binary files.
+To force <span class="sc">gnu</span> <samp><span
class="command">grep</span></samp>
+to output lines even from files that appear to be binary, use the
+‘<samp><span class="samp">-a</span></samp>’ or ‘<samp><span
class="samp">--binary-files=text</span></samp>’ option.
+To eliminate the
+“Binary file matches” messages, use the ‘<samp><span
class="samp">-I</span></samp>’ or
+‘<samp><span
class="samp">--binary-files=without-match</span></samp>’ option.
+
+ <li>Why doesn't ‘<samp><span class="samp">grep
-lv</span></samp>’ print non-matching file names?
+
+ <p>‘<samp><span class="samp">grep -lv</span></samp>’ lists
the names of all files containing one or more
+lines that do not match.
+To list the names of all files that contain no
+matching lines, use the ‘<samp><span
class="samp">-L</span></samp>’ or ‘<samp><span
class="samp">--files-without-match</span></samp>’
+option.
+
+ <li>I can do <span class="sc">or</span> with ‘<samp><span
class="samp">|</span></samp>’, but what about <span class="sc">and</span>?
+
+ <pre class="example"> grep 'paul' /etc/motd | grep 'franc,ois'
+</pre>
+ <p class="noindent">finds all lines that contain both ‘<samp><span
class="samp">paul</span></samp>’ and ‘<samp><span
class="samp">franc,ois</span></samp>’.
+
+ <li>How can I search in both standard input and in files?
+
+ <p>Use the special file name ‘<samp><span
class="samp">-</span></samp>’:
+
+ <pre class="example"> cat /etc/passwd | grep 'alain' - /etc/motd
+</pre>
+ <li><a name="index-palindromes-244"></a>How to express palindromes in a
regular expression?
+
+ <p>It can be done by using back-references;
+for example,
+a palindrome of 4 characters can be written with a BRE:
+
+ <pre class="example"> grep -w -e '\(.\)\(.\).\2\1' file
+</pre>
+ <p>It matches the word "radar" or "civic".
+
+ <p>Guglielmo Bondioni proposed a single RE
+that finds all palindromes up to 19 characters long
+using 9 subexpressions<!-- /@w --> and 9 back-references<!-- /@w -->:
+
+ <pre class="smallexample"> grep -E -e
'^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' file
+</pre>
+ <p>Note this is done by using <span class="sc">gnu</span> ERE extensions;
+it might not be portable to other implementations of <samp><span
class="command">grep</span></samp>.
+
+ <li>Why is this back-reference failing?
+
+ <pre class="example"> echo 'ba' | grep -E '(a)\1|b\1'
+</pre>
+ <p>This gives no output, because the first alternate ‘<samp><span
class="samp">(a)\1</span></samp>’ does not match,
+as there is no ‘<samp><span class="samp">aa</span></samp>’ in the
input, so the ‘<samp><span class="samp">\1</span></samp>’ in the
second alternate
+has nothing to refer back to, meaning it will never match anything.
+(The second alternate in this example can only match
+if the first alternate has matched – making the second one superfluous.)
+
+ <li>What do <samp><span class="command">grep</span></samp>, <samp><span
class="command">fgrep</span></samp>, and <samp><span
class="command">egrep</span></samp> stand for?
+
+ <p>The name <samp><span class="command">grep</span></samp> comes from the
way line editing was done on Unix.
+For example,
+<samp><span class="command">ed</span></samp> uses the following syntax
+to print a list of matching lines on the screen:
+
+ <pre class="example"> global/regular expression/print
+ g/re/p
+</pre>
+ <p><samp><span class="command">fgrep</span></samp> stands for Fixed
<samp><span class="command">grep</span></samp>;
+<samp><span class="command">egrep</span></samp> stands for Extended
<samp><span class="command">grep</span></samp>.
+
+ </ol>
+
+<div class="node">
+<a name="Reporting-Bugs"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Copying">Copying</a>,
+Previous: <a rel="previous" accesskey="p" href="#Usage">Usage</a>,
+Up: <a rel="up" accesskey="u" href="#Top">Top</a>
+
+</div>
+
+<h2 class="chapter">5 Reporting bugs</h2>
+
+<p><a name="index-bugs_002c-reporting-245"></a>Email bug reports to <a
href="mailto:address@hidden";>address@hidden</a>,
+a mailing list whose web page is
+<a
href="http://lists.gnu.org/mailman/listinfo/bug-grep";>http://lists.gnu.org/mailman/listinfo/bug-grep</a>.
+The Savannah bug tracker for <samp><span class="command">grep</span></samp> is
located at
+<a
href="http://savannah.gnu.org/bugs/?group=grep";>http://savannah.gnu.org/bugs/?group=grep</a>.
+
+<h3 class="section">5.1 Known Bugs</h3>
+
+<p><a name="index-Bugs_002c-known-246"></a>
+Large repetition counts in the ‘<samp><span
class="samp">{n,m}</span></samp>’ construct may cause
+<samp><span class="command">grep</span></samp> to use lots of memory.
+In addition, certain other
+obscure regular expressions require exponential time and
+space, and may cause <samp><span class="command">grep</span></samp> to run out
of memory.
+
+ <p>Back-references are very slow, and may require exponential time.
+
+<div class="node">
+<a name="Copying"></a>
+<p><hr>
+Next: <a rel="next" accesskey="n" href="#Index">Index</a>,
+Previous: <a rel="previous" accesskey="p"
href="#Reporting-Bugs">Reporting Bugs</a>,
+Up: <a rel="up" accesskey="u" href="#Top">Top</a>
+
+</div>
+
+<h2 class="chapter">6 Copying</h2>
+
+<p><a name="index-copying-247"></a>
+GNU grep is licensed under the GNU GPL, which makes it <dfn>free
+software</dfn>.
+
+ <p>The “free” in “free software” refers to liberty,
not price. As
+some GNU project advocates like to point out, think of “free
speech”
+rather than “free beer”. In short, you have the right (freedom) to
+run and change grep and distribute it to other people, and—if you
+want—charge money for doing either. The important restriction is
+that you have to grant your recipients the same rights and impose the
+same restrictions.
+
+ <p>This general method of licensing software is sometimes called
+<dfn>open source</dfn>. The GNU project prefers the term “free
software”
+for reasons outlined at
+<a
href="http://www.gnu.org/philosophy/open-source-misses-the-point.html";>http://www.gnu.org/philosophy/open-source-misses-the-point.html</a>.
+
+ <p>This manual is free documentation in the same sense. The
+documentation license is included below. The license for the program
+is available with the source code, or at
+<a
href="http://www.gnu.org/licenses/gpl.html";>http://www.gnu.org/licenses/gpl.html</a>.
+
+<ul class="menu">
+<li><a accesskey="1" href="#GNU-Free-Documentation-License">GNU Free
Documentation License</a>
+</ul>
+
+<div class="node">
+<a name="GNU-Free-Documentation-License"></a>
+<p><hr>
+Up: <a rel="up" accesskey="u" href="#Copying">Copying</a>
+
+</div>
+
+<h3 class="section">6.1 GNU Free Documentation License</h3>
+
+<!-- The GNU Free Documentation License. -->
+<div align="center">Version 1.3, 3 November 2008</div>
+
+<!-- This file is intended to be included within another document, -->
+<!-- hence no sectioning command or @node. -->
+<pre class="display"> Copyright © 2000, 2001, 2002, 2007, 2008 Free
Software Foundation, Inc.
+ <a href="http://fsf.org/";>http://fsf.org/</a>
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+</pre>
+ <ol type=1 start=0>
+<li>PREAMBLE
+
+ <p>The purpose of this License is to make a manual, textbook, or other
+functional and useful document <dfn>free</dfn> in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+ <p>This License is a kind of “copyleft”, which means that
derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+ <p>We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+ <li>APPLICABILITY AND DEFINITIONS
+
+ <p>This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The “Document”, below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as “you”. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+ <p>A “Modified Version” of the Document means any work
containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+ <p>A “Secondary Section” is a named appendix or a
front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+ <p>The “Invariant Sections” are certain Secondary Sections
whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+ <p>The “Cover Texts” are certain short passages of text that
are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+ <p>A “Transparent” copy of the Document means a
machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not “Transparent” is called
“Opaque”.
+
+ <p>Examples of suitable formats for Transparent copies include plain
+<span class="sc">ascii</span> without markup, Texinfo input format, LaTeX input
+format, <acronym>SGML</acronym> or <acronym>XML</acronym> using a publicly
available
+<acronym>DTD</acronym>, and standard-conforming simple <acronym>HTML</acronym>,
+PostScript or <acronym>PDF</acronym> designed for human modification. Examples
+of transparent image formats include <acronym>PNG</acronym>,
<acronym>XCF</acronym> and
+<acronym>JPG</acronym>. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, <acronym>SGML</acronym> or
+<acronym>XML</acronym> for which the <acronym>DTD</acronym> and/or processing
tools are
+not generally available, and the machine-generated <acronym>HTML</acronym>,
+PostScript or <acronym>PDF</acronym> produced by some word processors for
+output purposes only.
+
+ <p>The “Title Page” means, for a printed book, the title page
itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, “Title Page”
means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+ <p>The “publisher” means any person or entity that
distributes copies
+of the Document to the public.
+
+ <p>A section “Entitled XYZ” means a named subunit of the
Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as “Acknowledgements”,
+“Dedications”, “Endorsements”, or
“History”.) To “Preserve the Title”
+of such a section when you modify the Document means that it remains a
+section “Entitled XYZ” according to this definition.
+
+ <p>The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+ <li>VERBATIM COPYING
+
+ <p>You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+ <p>You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+ <li>COPYING IN QUANTITY
+
+ <p>If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+ <p>If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+ <p>If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+ <p>It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+ <li>MODIFICATIONS
+
+ <p>You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+ <ol type=A start=1>
+<li>Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+ <li>List on the Title Page, as authors, one or more persons or
entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+ <li>State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+ <li>Preserve all the copyright notices of the Document.
+
+ <li>Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+ <li>Include, immediately after the copyright notices, a license
notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+ <li>Preserve in that license notice the full lists of Invariant
Sections
+and required Cover Texts given in the Document's license notice.
+
+ <li>Include an unaltered copy of this License.
+
+ <li>Preserve the section Entitled “History”, Preserve
its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled “History” in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+ <li>Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the “History” section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+ <li>For any section Entitled “Acknowledgements” or
“Dedications”, Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+ <li>Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+ <li>Delete any section Entitled “Endorsements”. Such a
section
+may not be included in the Modified Version.
+
+ <li>Do not retitle any existing section to be Entitled
“Endorsements” or
+to conflict in title with any Invariant Section.
+
+ <li>Preserve any Warranty Disclaimers.
+ </ol>
+
+ <p>If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+ <p>You may add a section Entitled “Endorsements”, provided it
contains
+nothing but endorsements of your Modified Version by various
+parties—for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+ <p>You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+ <p>The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+ <li>COMBINING DOCUMENTS
+
+ <p>You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+ <p>The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+ <p>In the combination, you must combine any sections Entitled
“History”
+in the various original documents, forming one section Entitled
+“History”; likewise combine any sections Entitled
“Acknowledgements”,
+and any sections Entitled “Dedications”. You must delete all
+sections Entitled “Endorsements.”
+
+ <li>COLLECTIONS OF DOCUMENTS
+
+ <p>You may make a collection consisting of the Document and other
documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+ <p>You may extract a single document from such a collection, and
distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+ <li>AGGREGATION WITH INDEPENDENT WORKS
+
+ <p>A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an “aggregate” if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+ <p>If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+ <li>TRANSLATION
+
+ <p>Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+ <p>If a section in the Document is Entitled
“Acknowledgements”,
+“Dedications”, or “History”, the requirement (section
4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+ <li>TERMINATION
+
+ <p>You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+
+ <p>However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+
+ <p>Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ <p>Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+
+ <li>FUTURE REVISIONS OF THIS LICENSE
+
+ <p>The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+<a href="http://www.gnu.org/copyleft/";>http://www.gnu.org/copyleft/</a>.
+
+ <p>Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License “or any later version” applies to it, you have the option
of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation. If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy's public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+
+ <li>RELICENSING
+
+ <p>“Massive Multiauthor Collaboration Site” (or “MMC
Site”) means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works. A
+public wiki that anybody can edit is an example of such a server. A
+“Massive Multiauthor Collaboration” (or “MMC”)
contained in the
+site means any set of copyrightable works thus published on the MMC
+site.
+
+ <p>“CC-BY-SA” means the Creative Commons Attribution-Share
Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+
+ <p>“Incorporate” means to publish or republish a Document, in
whole or
+in part, as part of another Document.
+
+ <p>An MMC is “eligible for relicensing” if it is licensed
under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole
+or in part into the MMC, (1) had no cover texts or invariant sections,
+and (2) were thus incorporated prior to November 1, 2008.
+
+ <p>The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+
+ </ol>
+
+<h3 class="heading">ADDENDUM: How to use this License for your documents</h3>
+
+<p>To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+<pre class="smallexample"> Copyright (C) <var>year</var> <var>your
name</var>.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.3
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+</pre>
+ <p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the “with<small class="dots">...</small>Texts.” line with
this:
+
+<pre class="smallexample"> with the Invariant Sections being <var>list
their titles</var>, with
+ the Front-Cover Texts being <var>list</var>, and with the Back-Cover
Texts
+ being <var>list</var>.
+</pre>
+ <p>If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ <p>If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
+<!-- Local Variables: -->
+<!-- ispell-local-pdict: "ispell-dict" -->
+<!-- End: -->
+<div class="node">
+<a name="Index"></a>
+<p><hr>
+Previous: <a rel="previous" accesskey="p" href="#Copying">Copying</a>,
+Up: <a rel="up" accesskey="u" href="#Top">Top</a>
+
+</div>
+
+<h2 class="unnumbered">Index</h2>
+
+<ul class="index-cp" compact>
+<li><a href="#index-g_t_002a-185"><code>*</code></a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-g_t_002b-188"><code>+</code></a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-g_t_002d_002dafter_002dcontext-77"><code>--after-context</code></a>:
<a href="#Context-Line-Control">Context Line Control</a></li>
+<li><a
href="#index-g_t_002d_002dbasic_002dregexp-167"><code>--basic-regexp</code></a>:
<a href="#grep-Programs">grep Programs</a></li>
+<li><a
href="#index-g_t_002d_002dbefore_002dcontext-81"><code>--before-context</code></a>:
<a href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-g_t_002d_002dbinary-120"><code>--binary</code></a>: <a
href="#Other-Options">Other Options</a></li>
+<li><a
href="#index-g_t_002d_002dbinary_002dfiles-92"><code>--binary-files</code></a>:
<a href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002dbyte_002doffset-53"><code>--byte-offset</code></a>:
<a href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002d_002dcolor-30"><code>--color</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002d_002dcolour-31"><code>--colour</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002d_002dcontext-85"><code>--context</code></a>: <a
href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-g_t_002d_002dcount-28"><code>--count</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002d_002ddevices-95"><code>--devices</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002ddirectories-98"><code>--directories</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-g_t_002d_002dexclude-100"><code>--exclude</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002dexclude_002ddir-106"><code>--exclude-dir</code></a>:
<a href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002dexclude_002dfrom-103"><code>--exclude-from</code></a>:
<a href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002dextended_002dregexp-170"><code>--extended-regexp</code></a>:
<a href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-g_t_002d_002dfile-11"><code>--file</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a
href="#index-g_t_002d_002dfiles_002dwith_002dmatches-37"><code>--files-with-matches</code></a>:
<a href="#General-Output-Control">General Output Control</a></li>
+<li><a
href="#index-g_t_002d_002dfiles_002dwithout_002dmatch-34"><code>--files-without-match</code></a>:
<a href="#General-Output-Control">General Output Control</a></li>
+<li><a
href="#index-g_t_002d_002dfixed_002dstrings-173"><code>--fixed-strings</code></a>:
<a href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-g_t_002d_002dhelp-2"><code>--help</code></a>: <a
href="#Generic-Program-Information">Generic Program Information</a></li>
+<li><a
href="#index-g_t_002d_002dignore_002dcase-15"><code>--ignore-case</code></a>:
<a href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002d_002dinclude-108"><code>--include</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002dinitial_002dtab-67"><code>--initial-tab</code></a>:
<a href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-g_t_002d_002dinvert_002dmatch-18"><code>--invert-match</code></a>:
<a href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002d_002dlabel-61"><code>--label</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-g_t_002d_002dline_002dbuffered-115"><code>--line-buffered</code></a>:
<a href="#Other-Options">Other Options</a></li>
+<li><a
href="#index-g_t_002d_002dline_002dnumber-64"><code>--line-number</code></a>:
<a href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-g_t_002d_002dline_002dregexp-25"><code>--line-regexp</code></a>:
<a href="#Matching-Control">Matching Control</a></li>
+<li><a
href="#index-g_t_002d_002dmax_002dcount-40"><code>--max-count</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002d_002dmmap-117"><code>--mmap</code></a>: <a
href="#Other-Options">Other Options</a></li>
+<li><a
href="#index-g_t_002d_002dno_002dfilename-59"><code>--no-filename</code></a>:
<a href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-g_t_002d_002dno_002dmessages-50"><code>--no-messages</code></a>:
<a href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002d_002dnull-74"><code>--null</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-g_t_002d_002dnull_002ddata-124"><code>--null-data</code></a>: <a
href="#Other-Options">Other Options</a></li>
+<li><a
href="#index-g_t_002d_002donly_002dmatching-43"><code>--only-matching</code></a>:
<a href="#General-Output-Control">General Output Control</a></li>
+<li><a
href="#index-g_t_002d_002dperl_002dregexp-176"><code>--perl-regexp</code></a>:
<a href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-g_t_002d_002dquiet-46"><code>--quiet</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002d_002drecursive-112"><code>--recursive</code></a>:
<a href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002dregexp_003d_0040var_007bpattern_007d-8"><code>--regexp=</code><var>pattern</var></a>:
<a href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002d_002dsilent-47"><code>--silent</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002d_002dtext-89"><code>--text</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-g_t_002d_002dunix_002dbyte_002doffsets-70"><code>--unix-byte-offsets</code></a>:
<a href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002d_002dversion-5"><code>--version</code></a>: <a
href="#Generic-Program-Information">Generic Program Information</a></li>
+<li><a
href="#index-g_t_002d_002dwith_002dfilename-56"><code>--with-filename</code></a>:
<a href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-g_t_002d_002dword_002dregexp-22"><code>--word-regexp</code></a>:
<a href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002da-88"><code>-a</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-g_t_002dA-76"><code>-A</code></a>: <a
href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-g_t_002dB-80"><code>-B</code></a>: <a
href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-g_t_002db-52"><code>-b</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002dC-84"><code>-C</code></a>: <a
href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-g_t_002dc-27"><code>-c</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002dd-97"><code>-d</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-g_t_002dD-94"><code>-D</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-g_t_002dE-169"><code>-E</code></a>: <a
href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-g_t_002de-7"><code>-e</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002dF-172"><code>-F</code></a>: <a
href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-g_t_002df-10"><code>-f</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002dG-166"><code>-G</code></a>: <a
href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-g_t_002dh-58"><code>-h</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002dH-55"><code>-H</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002di-13"><code>-i</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002dl-36"><code>-l</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002dL-33"><code>-L</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002dm-39"><code>-m</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002dn-63"><code>-n</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-g_t_002d_0040var_007bnum_007d-86"><code>-</code><var>num</var></a>:
<a href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-g_t_002do-42"><code>-o</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002dP-175"><code>-P</code></a>: <a
href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-g_t_002dq-45"><code>-q</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002dr-111"><code>-r</code></a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-g_t_002ds-49"><code>-s</code></a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-g_t_002dT-66"><code>-T</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002dU-119"><code>-U</code></a>: <a
href="#Other-Options">Other Options</a></li>
+<li><a href="#index-g_t_002du-69"><code>-u</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002dv-17"><code>-v</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002dV-4"><code>-V</code></a>: <a
href="#Generic-Program-Information">Generic Program Information</a></li>
+<li><a href="#index-g_t_002dw-21"><code>-w</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002dx-24"><code>-x</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002dy-14"><code>-y</code></a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-g_t_002dz-123"><code>-z</code></a>: <a
href="#Other-Options">Other Options</a></li>
+<li><a href="#index-g_t_002dZ-73"><code>-Z</code></a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-g_t_002e-179"><code>.</code></a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-g_t_003f-182"><code>?</code></a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-g_t_005f_0040var_007bN_007d_005fGNU_005fnonoption_005fargv_005fflags_005f-_0040r_007benvironment-variable_007d-161"><code>_</code><var>N</var><code>_GNU_nonoption_argv_flags_
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-after-context-78">after context</a>: <a
href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-alnum-_0040r_007bcharacter-class_007d-208"><code>alnum
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-alpha-_0040r_007bcharacter-class_007d-210"><code>alpha
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-alphabetic-characters-211">alphabetic characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-alphanumeric-characters-209">alphanumeric characters</a>:
<a href="#Character-Classes-and-Bracket-Expressions">Character Classes and
Bracket Expressions</a></li>
+<li><a href="#index-anchoring-236">anchoring</a>: <a
href="#Anchoring">Anchoring</a></li>
+<li><a href="#index-asterisk-186">asterisk</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-back_002dreference-238">back-reference</a>: <a
href="#Back_002dreferences-and-Subexpressions">Back-references and
Subexpressions</a></li>
+<li><a href="#index-backslash-235">backslash</a>: <a
href="#The-Backslash-Character-and-Special-Expressions">The Backslash Character
and Special Expressions</a></li>
+<li><a href="#index-basic-regular-expressions-239">basic regular
expressions</a>: <a href="#Basic-vs-Extended">Basic vs Extended</a></li>
+<li><a href="#index-before-context-82">before context</a>: <a
href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-binary-files-91">binary files</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a
href="#index-binary-files_002c-_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-122">binary
files, <span class="sc">ms-dos</span>/<span class="sc">ms</span>-Windows</a>:
<a href="#Other-Options">Other Options</a></li>
+<li><a href="#index-blank-_0040r_007bcharacter-class_007d-212"><code>blank
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-blank-characters-213">blank characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a
href="#index-bn-GREP_005fCOLORS-_0040r_007bcapability_007d-141"><code>bn
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-braces_002c-first-argument-omitted-198">braces, first
argument omitted</a>: <a href="#Fundamental-Structure">Fundamental
Structure</a></li>
+<li><a href="#index-braces_002c-one-argument-192">braces, one argument</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-braces_002c-second-argument-omitted-195">braces, second
argument omitted</a>: <a href="#Fundamental-Structure">Fundamental
Structure</a></li>
+<li><a href="#index-braces_002c-two-arguments-201">braces, two arguments</a>:
<a href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-bracket-expression-203">bracket expression</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-Bugs_002c-known-246">Bugs, known</a>: <a
href="#Reporting-Bugs">Reporting Bugs</a></li>
+<li><a href="#index-bugs_002c-reporting-245">bugs, reporting</a>: <a
href="#Reporting-Bugs">Reporting Bugs</a></li>
+<li><a href="#index-byte-offset-54">byte offset</a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-byte-offsets_002c-on-_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-72">byte
offsets, on <span class="sc">ms-dos</span>/<span
class="sc">ms</span>-Windows</a>: <a href="#Output-Line-Prefix-Control">Output
Line Prefix Control</a></li>
+<li><a href="#index-case-insensitive-search-16">case insensitive search</a>:
<a href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-changing-name-of-standard-input-62">changing name of
standard input</a>: <a href="#Output-Line-Prefix-Control">Output Line Prefix
Control</a></li>
+<li><a href="#index-character-class-204">character class</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-character-classes-207">character classes</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-character-type-147">character type</a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-classes-of-characters-206">classes of characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-cntrl-_0040r_007bcharacter-class_007d-214"><code>cntrl
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-context-87">context</a>: <a
href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-context-lines_002c-after-match-79">context lines, after
match</a>: <a href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-context-lines_002c-before-match-83">context lines, before
match</a>: <a href="#Context-Line-Control">Context Line Control</a></li>
+<li><a href="#index-control-characters-215">control characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-copying-247">copying</a>: <a
href="#Copying">Copying</a></li>
+<li><a href="#index-counting-lines-29">counting lines</a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a
href="#index-cx-GREP_005fCOLORS-_0040r_007bcapability_007d-134"><code>cx
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-default-options-environment-variable-128">default options
environment variable</a>: <a href="#Environment-Variables">Environment
Variables</a></li>
+<li><a href="#index-device-search-96">device search</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-digit-_0040r_007bcharacter-class_007d-216"><code>digit
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-digit-characters-217">digit characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-directory-search-99">directory search</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-dot-180">dot</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-environment-variables-126">environment variables</a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-exclude-directories-107">exclude directories</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-exclude-files-101">exclude files</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-exit-status-162">exit status</a>: <a
href="#Exit-Status">Exit Status</a></li>
+<li><a href="#index-FAQ-about-_0040command_007bgrep_007d-usage-243">FAQ about
<samp><span class="command">grep</span></samp> usage</a>: <a
href="#Usage">Usage</a></li>
+<li><a href="#index-files-which-don_0027t-match-35">files which don't
match</a>: <a href="#General-Output-Control">General Output Control</a></li>
+<li><a
href="#index-fn-GREP_005fCOLORS-_0040r_007bcapability_007d-139"><code>fn
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-graph-_0040r_007bcharacter-class_007d-219"><code>graph
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-graphic-characters-220">graphic characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-g_t_0040command_007bgrep_007d-programs-164"><samp><span
class="command">grep</span></samp> programs</a>: <a href="#grep-Programs">grep
Programs</a></li>
+<li><a
href="#index-GREP_005fCOLOR-_0040r_007benvironment-variable_007d-129"><code>GREP_COLOR
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-GREP_005fCOLORS-_0040r_007benvironment-variable_007d-131"><code>GREP_COLORS
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-GREP_005fOPTIONS-_0040r_007benvironment-variable_007d-127"><code>GREP_OPTIONS
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-hexadecimal-digits-234">hexadecimal digits</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-highlight-markers-130">highlight markers</a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-highlight_002c-color_002c-colour-32">highlight, color,
colour</a>: <a href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-include-files-109">include files</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-interval-specifications-240">interval specifications</a>:
<a href="#Basic-vs-Extended">Basic vs Extended</a></li>
+<li><a href="#index-invert-matching-19">invert matching</a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-LANG-_0040r_007benvironment-variable_007d-146"><code>LANG
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-language-of-messages-156">language of messages</a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-LC_005fALL-_0040r_007benvironment-variable_007d-144"><code>LC_ALL
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-LC_005fCOLLATE-_0040r_007benvironment-variable_007d-145"><code>LC_COLLATE
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-LC_005fCTYPE-_0040r_007benvironment-variable_007d-151"><code>LC_CTYPE
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-LC_005fMESSAGES-_0040r_007benvironment-variable_007d-154"><code>LC_MESSAGES
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-line-buffering-116">line buffering</a>: <a
href="#Other-Options">Other Options</a></li>
+<li><a href="#index-line-numbering-65">line numbering</a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-ln-GREP_005fCOLORS-_0040r_007bcapability_007d-140"><code>ln
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-lower-_0040r_007bcharacter-class_007d-221"><code>lower
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-lower_002dcase-letters-222">lower-case letters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a
href="#index-match-expression-at-most-_0040var_007bm_007d-times-199">match
expression at most <var>m</var> times</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-match-expression-at-most-once-184">match expression at
most once</a>: <a href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-match-expression-from-_0040var_007bn_007d-to-_0040var_007bm_007d-times-202">match
expression from <var>n</var> to <var>m</var> times</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-match-expression-_0040var_007bn_007d-or-more-times-196">match
expression <var>n</var> or more times</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-match-expression-_0040var_007bn_007d-times-193">match
expression <var>n</var> times</a>: <a href="#Fundamental-Structure">Fundamental
Structure</a></li>
+<li><a href="#index-match-expression-one-or-more-times-190">match expression
one or more times</a>: <a href="#Fundamental-Structure">Fundamental
Structure</a></li>
+<li><a href="#index-match-expression-zero-or-more-times-187">match expression
zero or more times</a>: <a href="#Fundamental-Structure">Fundamental
Structure</a></li>
+<li><a href="#index-match-the-whole-line-26">match the whole line</a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-matching-basic-regular-expressions-168">matching basic
regular expressions</a>: <a href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-matching-extended-regular-expressions-171">matching
extended regular expressions</a>: <a href="#grep-Programs">grep
Programs</a></li>
+<li><a href="#index-matching-fixed-strings-174">matching fixed strings</a>: <a
href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-matching-Perl-regular-expressions-177">matching Perl
regular expressions</a>: <a href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-matching-whole-words-23">matching whole words</a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-max_002dcount-41">max-count</a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a
href="#index-mc-GREP_005fCOLORS-_0040r_007bcapability_007d-138"><code>mc
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-memory-mapped-input-118">memory mapped input</a>: <a
href="#Other-Options">Other Options</a></li>
+<li><a href="#index-message-language-157">message language</a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-ms-GREP_005fCOLORS-_0040r_007bcapability_007d-137"><code>ms
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-g_t_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-binary-files-121"><span
class="sc">ms-dos</span>/<span class="sc">ms</span>-Windows binary files</a>:
<a href="#Other-Options">Other Options</a></li>
+<li><a
href="#index-g_t_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-byte-offsets-71"><span
class="sc">ms-dos</span>/<span class="sc">ms</span>-Windows byte offsets</a>:
<a href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a
href="#index-mt-GREP_005fCOLORS-_0040r_007bcapability_007d-136"><code>mt
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-names-of-matching-files-38">names of matching files</a>:
<a href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-national-language-support-148">national language
support</a>: <a href="#Environment-Variables">Environment Variables</a></li>
+<li><a
href="#index-ne-GREP_005fCOLORS-_0040r_007bcapability_007d-143"><code>ne
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-NLS-149">NLS</a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-no-filename-prefix-60">no filename prefix</a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-numeric-characters-218">numeric characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-only-matching-44">only matching</a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-palindromes-244">palindromes</a>: <a
href="#Usage">Usage</a></li>
+<li><a href="#index-pattern-from-file-12">pattern from file</a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-pattern-list-9">pattern list</a>: <a
href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-period-181">period</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-plus-sign-189">plus sign</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-POSIXLY_005fCORRECT-_0040r_007benvironment-variable_007d-160"><code>POSIXLY_CORRECT
</code><span class="roman">environment variable</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-print-_0040r_007bcharacter-class_007d-223"><code>print
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-print-non_002dmatching-lines-20">print non-matching
lines</a>: <a href="#Matching-Control">Matching Control</a></li>
+<li><a href="#index-printable-characters-224">printable characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-punct-_0040r_007bcharacter-class_007d-225"><code>punct
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-punctuation-characters-226">punctuation characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-question-mark-183">question mark</a>: <a
href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a href="#index-quiet_002c-silent-48">quiet, silent</a>: <a
href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-range-expression-205">range expression</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-recursive-search-113">recursive search</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-regular-expressions-178">regular expressions</a>: <a
href="#Regular-Expressions">Regular Expressions</a></li>
+<li><a href="#index-return-status-163">return status</a>: <a
href="#Exit-Status">Exit Status</a></li>
+<li><a
href="#index-rv-GREP_005fCOLORS-_0040r_007bcapability_007d-135"><code>rv
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-searching-directory-trees-102">searching directory
trees</a>: <a href="#File-and-Directory-Selection">File and Directory
Selection</a></li>
+<li><a href="#index-searching-for-a-pattern-1">searching for a pattern</a>: <a
href="#Introduction">Introduction</a></li>
+<li><a
href="#index-sl-GREP_005fCOLORS-_0040r_007bcapability_007d-133"><code>sl
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
+<li><a href="#index-space-_0040r_007bcharacter-class_007d-227"><code>space
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-space-characters-228">space characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-subexpression-237">subexpression</a>: <a
href="#Back_002dreferences-and-Subexpressions">Back-references and
Subexpressions</a></li>
+<li><a href="#index-suppress-binary-data-90">suppress binary data</a>: <a
href="#File-and-Directory-Selection">File and Directory Selection</a></li>
+<li><a href="#index-suppress-error-messages-51">suppress error messages</a>:
<a href="#General-Output-Control">General Output Control</a></li>
+<li><a href="#index-tab_002daligned-content-lines-68">tab-aligned content
lines</a>: <a href="#Output-Line-Prefix-Control">Output Line Prefix
Control</a></li>
+<li><a href="#index-translation-of-message-language-159">translation of
message language</a>: <a href="#Environment-Variables">Environment
Variables</a></li>
+<li><a href="#index-upper-_0040r_007bcharacter-class_007d-230"><code>upper
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-upper_002dcase-letters-231">upper-case letters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-usage-summary_002c-printing-3">usage summary,
printing</a>: <a href="#Generic-Program-Information">Generic Program
Information</a></li>
+<li><a href="#index-usage_002c-examples-241">usage, examples</a>: <a
href="#Usage">Usage</a></li>
+<li><a href="#index-using-_0040command_007bgrep_007d_002c-Q_0026A-242">using
<samp><span class="command">grep</span></samp>, Q&A</a>: <a
href="#Usage">Usage</a></li>
+<li><a href="#index-variants-of-_0040command_007bgerp_007d-165">variants of
<samp><span class="command">gerp</span></samp></a>: <a
href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-version_002c-printing-6">version, printing</a>: <a
href="#Generic-Program-Information">Generic Program Information</a></li>
+<li><a href="#index-whitespace-characters-229">whitespace characters</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-with-filename-prefix-57">with filename prefix</a>: <a
href="#Output-Line-Prefix-Control">Output Line Prefix Control</a></li>
+<li><a href="#index-xdigit-_0040r_007bcharacter-class_007d-232"><code>xdigit
</code><span class="roman">character class</span></a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-xdigit-class-233">xdigit class</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
+<li><a href="#index-zero_002dterminated-file-names-75">zero-terminated file
names</a>: <a href="#Output-Line-Prefix-Control">Output Line Prefix
Control</a></li>
+<li><a href="#index-zero_002dterminated-lines-125">zero-terminated lines</a>:
<a href="#Other-Options">Other Options</a></li>
+<li><a
href="#index-g_t_0040_007b_002c_0040var_007bm_007d_0040_007d-197"><code>{,</code><var>m</var><code>}</code></a>:
<a href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-g_t_0040_007b_0040var_007bn_007d_002c_0040var_007bm_007d_0040_007d-200"><code>{</code><var>n</var><code>,</code><var>m</var><code>}</code></a>:
<a href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-g_t_0040_007b_0040var_007bn_007d_002c_0040_007d-194"><code>{</code><var>n</var><code>,}</code></a>:
<a href="#Fundamental-Structure">Fundamental Structure</a></li>
+<li><a
href="#index-g_t_0040_007b_0040var_007bn_007d_0040_007d-191"><code>{</code><var>n</var><code>}</code></a>:
<a href="#Fundamental-Structure">Fundamental Structure</a></li>
+ </ul></body></html>
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to manual/grep.html,
Karl Berry <=