[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to grep/manual/grep.html,v
From: |
Jim Meyering |
Subject: |
Changes to grep/manual/grep.html,v |
Date: |
Fri, 02 Mar 2012 09:28:33 +0000 |
CVSROOT: /webcvs/grep
Module name: grep
Changes by: Jim Meyering <meyering> 12/03/02 09:28:32
Index: grep.html
===================================================================
RCS file: /webcvs/grep/grep/manual/grep.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- grep.html 25 Jun 2011 09:28:43 -0000 1.9
+++ grep.html 2 Mar 2012 09:28:23 -0000 1.10
@@ -1,15 +1,16 @@
<html lang="en">
<head>
-<title>GNU Grep 2.9</title>
+<title>GNU Grep 2.11</title>
<meta http-equiv="Content-Type" content="text/html">
-<meta name="description" content="GNU Grep 2.9">
+<meta name="description" content="GNU Grep 2.11">
<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-2002, 2005, 2008-2011 Free Software Foundation, Inc.
+Copyright (C) 1999-2002, 2005, 2008-2012 Free Software Foundation,
+Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
@@ -32,8 +33,8 @@
--></style>
</head>
<body>
-<h1 class="settitle">GNU Grep 2.9</h1>
-<div class="contents">
+<h1 class="settitle">GNU Grep 2.11</h1>
+ <div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Top" href="#Top">grep</a>
@@ -88,13 +89,14 @@
<h2 class="unnumbered">grep</h2>
-<p><samp><span class="command">grep</span></samp> prints lines that match a
pattern.
+<p><samp><span class="command">grep</span></samp> prints lines that contain a
match for a pattern.
- <p>This manual is for version 2.9 of GNU Grep.
+ <p>This manual is for version 2.11 of GNU Grep.
<p>This manual is for <samp><span class="command">grep</span></samp>, a
pattern matching engine.
- <p>Copyright © 1999-2002, 2005, 2008-2011 Free Software Foundation,
Inc.
+ <p>Copyright © 1999-2002, 2005, 2008-2012 Free Software Foundation,
+Inc.
<blockquote>
Permission is granted to copy, distribute and/or modify this document
@@ -127,7 +129,7 @@
<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
+<samp><span class="command">grep</span></samp> searches 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),
@@ -183,13 +185,13 @@
<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>,
+some from POSIX and some being GNU extensions.
+Long option names are always a GNU extension,
+even for options that are from POSIX specifications.
+Options that are specified by POSIX,
under their short names,
are explicitly marked as such
-to facilitate <span class="sc">posix</span>-portable programming.
+to facilitate POSIX-portable programming.
A few option names are provided
for compatibility with older or more exotic implementations.
@@ -218,10 +220,10 @@
<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
+<dt><samp><span class="option">--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.
+ <br><dt><samp><span class="option">-V</span></samp><dt><samp><span
class="option">--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>
@@ -238,23 +240,23 @@
<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.
+<dt><samp><span class="option">-e
</span><var>pattern</var></samp><dt><samp><span
class="option">--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>.)
+(<samp><span class="option">-e</span></samp> is specified by POSIX.)
- <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.
+ <br><dt><samp><span class="option">-f
</span><var>file</var></samp><dt><samp><span
class="option">--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>.)
+(<samp><span class="option">-f</span></samp> is specified by POSIX.)
- <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="option">-i</span></samp><dt><samp><span
class="option">-y</span></samp><dt><samp><span
class="option">--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="option">-y</span></samp> is an obsolete synonym that is
provided for compatibility.
+(<samp><span class="option">-i</span></samp> is specified by POSIX.)
- <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="option">-v</span></samp><dt><samp><span
class="option">--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="option">-v</span></samp> is specified by POSIX.)
- <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.
+ <br><dt><samp><span class="option">-w</span></samp><dt><samp><span
class="option">--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.
@@ -263,8 +265,8 @@
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>.)
+ <br><dt><samp><span class="option">-x</span></samp><dt><samp><span
class="option">--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="option">-x</span></samp> is specified by POSIX.)
</dl>
@@ -280,38 +282,38 @@
<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;
+<dt><samp><span class="option">-c</span></samp><dt><samp><span
class="option">--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,
+With the <samp><span class="option">-v</span></samp> (<samp><span
class="option">--invert-match</span></samp>) option,
count non-matching lines.
-(‘<samp><span class="samp">-c</span></samp>’ is specified by <span
class="sc">posix</span>.)
+(<samp><span class="option">-c</span></samp> is specified by POSIX.)
- <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,
+ <br><dt><samp><span class="option">--color[=</span><var>WHEN</var><span
class="option">]</span></samp><dt><samp><span
class="option">--colour[=</span><var>WHEN</var><span
class="option">]</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>
+The colors are defined by the environment variable <samp><span
class="env">GREP_COLORS</span></samp>
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,
+The deprecated environment variable <samp><span
class="env">GREP_COLOR</span></samp> 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;
+ <br><dt><samp><span class="option">-L</span></samp><dt><samp><span
class="option">--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.
+The scanning of each file stops 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;
+ <br><dt><samp><span class="option">-l</span></samp><dt><samp><span
class="option">--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>.)
+The scanning of each file stops on the first match.
+(<samp><span class="option">-l</span></samp> is specified by POSIX.)
- <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.
+ <br><dt><samp><span class="option">-m
</span><var>num</var></samp><dt><samp><span
class="option">--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
@@ -339,33 +341,33 @@
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,
+When the <samp><span class="option">-c</span></samp> or <samp><span
class="option">--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,
+When the <samp><span class="option">-v</span></samp> or <samp><span
class="option">--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,
+ <br><dt><samp><span class="option">-o</span></samp><dt><samp><span
class="option">--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.
+ <br><dt><samp><span class="option">-q</span></samp><dt><samp><span
class="option">--quiet</span></samp><dt><samp><span
class="option">--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>.)
+Also see the <samp><span class="option">-s</span></samp> or <samp><span
class="option">--no-messages</span></samp> option.
+(<samp><span class="option">-q</span></samp> is specified by POSIX.)
- <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.
+ <br><dt><samp><span class="option">-s</span></samp><dt><samp><span
class="option">--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.
+unlike GNU <samp><span class="command">grep</span></samp>,
+7th Edition Unix <samp><span class="command">grep</span></samp> did not
conform to POSIX,
+because it lacked <samp><span class="option">-q</span></samp>
+and its <samp><span class="option">-s</span></samp> option behaved like
+GNU <samp><span class="command">grep</span></samp>'s <samp><span
class="option">-q</span></samp> option.<a rel="footnote" href="#fn-1"
name="fnd-1"><sup>1</sup></a>
+USG-style <samp><span class="command">grep</span></samp> also lacked
<samp><span class="option">-q</span></samp>
+but its <samp><span class="option">-s</span></samp> option behaved like GNU
<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
+<samp><span class="option">-q</span></samp> and <samp><span
class="option">-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>.)
+(<samp><span class="option">-s</span></samp> is specified by POSIX.)
</dl>
@@ -385,51 +387,51 @@
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
+<dt><samp><span class="option">-b</span></samp><dt><samp><span
class="option">--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,
+If <samp><span class="option">-o</span></samp> (<samp><span
class="option">--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,
+When <samp><span class="command">grep</span></samp> runs on MS-DOS or
MS-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;
+the <samp><span class="option">-u</span></samp> (<samp><span
class="option">--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.
+ <br><dt><samp><span class="option">-H</span></samp><dt><samp><span
class="option">--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.
+ <br><dt><samp><span class="option">-h</span></samp><dt><samp><span
class="option">--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
+ <br><dt><samp><span
class="option">--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 when implementing tools like
<samp><span class="command">zgrep</span></samp>; e.g.:
<pre class="example"> gzip -cd foo.gz | grep --label=foo -H
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="option">-n</span></samp><dt><samp><span
class="option">--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="option">-n</span></samp> is specified by POSIX.)
- <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,
+ <br><dt><samp><span class="option">-T</span></samp><dt><samp><span
class="option">--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>’.
+<samp><span class="option">-H</span></samp>, <samp><span
class="option">-n</span></samp>, and <samp><span
class="option">-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.
+ <br><dt><samp><span class="option">-u</span></samp><dt><samp><span
class="option">--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-MS_002dDOS_002fMS_002dWindows-byte-offsets-71"></a><a
name="index-byte-offsets_002c-on-MS_002dDOS_002fMS_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.
+This option has no effect unless the <samp><span
class="option">-b</span></samp> option is also used;
+it has no effect on platforms other than MS-DOS and MS-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)
+ <br><dt><samp><span class="option">-Z</span></samp><dt><samp><span
class="option">--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
ASCII <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
@@ -456,40 +458,52 @@
<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,
+If the <samp><span class="option">-o</span></samp> (<samp><span
class="option">--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.
+<dt><samp><span class="option">-A </span><var>num</var></samp><dt><samp><span
class="option">--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="option">-B
</span><var>num</var></samp><dt><samp><span
class="option">--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.
+ <br><dt><samp><span class="option">-C
</span><var>num</var></samp><dt><samp><span
class="option">-</span><var>num</var></samp><dt><samp><span
class="option">--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.
- <br><dt>‘<samp><span
class="samp">--group-separator=</span><var>string</var></samp>’<dd><a
name="index-g_t_002d_002dgroup_002dseparator-88"></a><a
name="index-group-separator-89"></a>When <samp><span
class="option">-A</span></samp>, <samp><span class="option">-B</span></samp> or
<samp><span class="option">-C</span></samp> are in use,
-print <var>string</var> instead of ‘<samp><span
class="samp">--</span></samp>’ around disjoint groups
+ <br><dt><samp><span
class="option">--group-separator=</span><var>string</var></samp><dd><a
name="index-g_t_002d_002dgroup_002dseparator-88"></a><a
name="index-group-separator-89"></a>When <samp><span
class="option">-A</span></samp>, <samp><span class="option">-B</span></samp> or
<samp><span class="option">-C</span></samp> are in use,
+print <var>string</var> instead of <samp><span class="option">--</span></samp>
around disjoint groups
of lines.
- <br><dt>‘<samp><span
class="samp">--no-group-separator</span></samp>’<dd><a
name="index-g_t_002d_002dgroup_002dseparator-90"></a><a
name="index-group-separator-91"></a>When <samp><span
class="option">-A</span></samp>, <samp><span class="option">-B</span></samp> or
<samp><span class="option">-C</span></samp> are in use,
+ <br><dt><samp><span
class="option">--no-group-separator</span></samp><dd><a
name="index-g_t_002d_002dgroup_002dseparator-90"></a><a
name="index-group-separator-91"></a>When <samp><span
class="option">-A</span></samp>, <samp><span class="option">-B</span></samp> or
<samp><span class="option">-C</span></samp> are in use,
print disjoint groups of lines adjacent to each other.
</dl>
- <p>Matching lines normally use ‘<samp><span
class="samp">:</span></samp>’ as a separator
+ <p>Here are some points about how <samp><span
class="command">grep</span></samp> chooses
+the separator to print between prefix fields and line content:
+
+ <ul>
+<li>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,
+
+ <li>Context (i.e., non-matching) lines use ‘<samp><span
class="samp">-</span></samp>’ instead.
+
+ <li>When no context is specified,
matching lines are simply output one right after another.
-When nonzero context is specified,
+
+ <li>When nonzero context is specified,
lines that are adjacent in the input form a group
and are output one right after another, while
a separator appears by default between disjoint groups on a line
-of its own and without any prefix. The default separator
+of its own and without any prefix.
+
+ <li>The default separator
is ‘<samp><span class="samp">--</span></samp>’, however whether to
include it and its appearance
-can be changed with the options above. Each group may contain
+can be changed with the options above.
+
+ <li>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.
+</ul>
<div class="node">
<a name="File-and-Directory-Selection"></a>
@@ -503,33 +517,36 @@
<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-92"></a><a
name="index-g_t_002d_002dtext-93"></a><a
name="index-suppress-binary-data-94"></a><a
name="index-binary-files-95"></a>Process a binary file as if it were text;
+<dt><samp><span class="option">-a</span></samp><dt><samp><span
class="option">--text</span></samp><dd><a name="index-g_t_002da-92"></a><a
name="index-g_t_002d_002dtext-93"></a><a
name="index-suppress-binary-data-94"></a><a
name="index-binary-files-95"></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-96"></a><a
name="index-binary-files-97"></a>If the first few bytes of a file indicate that
the file contains binary data,
+ <br><dt><samp><span
class="option">--binary-files=</span><var>type</var></samp><dd><a
name="index-g_t_002d_002dbinary_002dfiles-96"></a><a
name="index-binary-files-97"></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>’,
+
+ <p>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>’,
+this is equivalent to the <samp><span class="option">-I</span></samp> option.
+
+ <p>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,
+this is equivalent to the <samp><span class="option">-a</span></samp> option.
+
+ <p><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-98"></a><a name="index-g_t_002d_002ddevices-99"></a><a
name="index-device-search-100"></a>If an input file is a device, FIFO, or
socket, use <var>action</var> to process it.
+ <br><dt><samp><span class="option">-D
</span><var>action</var></samp><dt><samp><span
class="option">--devices=</span><var>action</var></samp><dd><a
name="index-g_t_002dD-98"></a><a name="index-g_t_002d_002ddevices-99"></a><a
name="index-device-search-100"></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-101"></a><a
name="index-g_t_002d_002ddirectories-102"></a><a
name="index-directory-search-103"></a>If an input file is a directory, use
<var>action</var> to process it.
+ <br><dt><samp><span class="option">-d
</span><var>action</var></samp><dt><samp><span
class="option">--directories=</span><var>action</var></samp><dd><a
name="index-g_t_002dd-101"></a><a
name="index-g_t_002d_002ddirectories-102"></a><a
name="index-directory-search-103"></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,
@@ -538,28 +555,28 @@
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.
+this is equivalent to the <samp><span class="option">-r</span></samp> option.
- <br><dt>‘<samp><span
class="samp">--exclude=</span><var>glob</var></samp>’<dd><a
name="index-g_t_002d_002dexclude-104"></a><a
name="index-exclude-files-105"></a><a
name="index-searching-directory-trees-106"></a>Skip files whose base name
matches <var>glob</var>
+ <br><dt><samp><span
class="option">--exclude=</span><var>glob</var></samp><dd><a
name="index-g_t_002d_002dexclude-104"></a><a
name="index-exclude-files-105"></a><a
name="index-searching-directory-trees-106"></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-107"></a><a
name="index-exclude-files-108"></a><a
name="index-searching-directory-trees-109"></a>Skip files whose base name
matches any of the file-name globs
+ <br><dt><samp><span
class="option">--exclude-from=</span><var>file</var></samp><dd><a
name="index-g_t_002d_002dexclude_002dfrom-107"></a><a
name="index-exclude-files-108"></a><a
name="index-searching-directory-trees-109"></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>’).
+under <samp><span class="option">--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-110"></a><a
name="index-exclude-directories-111"></a>Exclude directories matching the
pattern <var>dir</var> from recursive
+ <br><dt><samp><span
class="option">--exclude-dir=</span><var>dir</var></samp><dd><a
name="index-g_t_002d_002dexclude_002ddir-110"></a><a
name="index-exclude-directories-111"></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;
+ <br><dt><samp><span class="option">-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-112"></a><a
name="index-include-files-113"></a><a
name="index-searching-directory-trees-114"></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="option">--include=</span><var>glob</var></samp><dd><a
name="index-g_t_002d_002dinclude-112"></a><a
name="index-include-files-113"></a><a
name="index-searching-directory-trees-114"></a>Search only files whose base
name matches <var>glob</var>
+(using wildcard matching as described under <samp><span
class="option">--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-115"></a><a
name="index-g_t_002d_002drecursive-116"></a><a
name="index-recursive-search-117"></a><a
name="index-searching-directory-trees-118"></a>For each directory mentioned on
the command line,
+ <br><dt><samp><span class="option">-r</span></samp><dt><samp><span
class="option">-R</span></samp><dt><samp><span
class="option">--recursive</span></samp><dd><a
name="index-g_t_002dr-115"></a><a
name="index-g_t_002d_002drecursive-116"></a><a
name="index-recursive-search-117"></a><a
name="index-searching-directory-trees-118"></a>For each directory operand,
read and process all files in that directory, recursively.
This is the same as the ‘<samp><span
class="samp">--directories=recurse</span></samp>’ option.
@@ -576,31 +593,32 @@
<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-119"></a><a
name="index-line-buffering-120"></a>Use line buffering on output.
+<dt><samp><span class="option">--line-buffered</span></samp><dd><a
name="index-g_t_002d_002dline_002dbuffered-119"></a><a
name="index-line-buffering-120"></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-121"></a><a
name="index-memory-mapped-input-122"></a>This option is ignored for backwards
compatibility. It used to read
+ <br><dt><samp><span class="option">--mmap</span></samp><dd><a
name="index-g_t_002d_002dmmap-121"></a><a
name="index-memory-mapped-input-122"></a>This option is deprecated and now
elicits a warning, but is otherwise a no-op.
+It used to make <samp><span class="command">grep</span></samp> read
input with the <code>mmap</code> system call, instead of the default
<code>read</code>
system call. On modern systems, <code>mmap</code> would rarely if ever yield
better performance.
- <br><dt>‘<samp><span
class="samp">-U</span></samp>’<dt>‘<samp><span
class="samp">--binary</span></samp>’<dd><a
name="index-g_t_002dU-123"></a><a name="index-g_t_002d_002dbinary-124"></a><a
name="index-g_t_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-binary-files-125"></a><a
name="index-binary-files_002c-_0040sc_007bms_002ddos_007d_002f_0040sc_007bms_007d_002dWindows-126"></a>Treat
the file(s) as binary.
-By default, under <span class="sc">ms-dos</span> and <span
class="sc">ms</span>-Windows,
+ <br><dt><samp><span class="option">-U</span></samp><dt><samp><span
class="option">--binary</span></samp><dd><a name="index-g_t_002dU-123"></a><a
name="index-g_t_002d_002dbinary-124"></a><a
name="index-MS_002dDOS_002fMS_002dWindows-binary-files-125"></a><a
name="index-binary-files_002c-MS_002dDOS_002fMS_002dWindows-126"></a>Treat the
file(s) as binary.
+By default, under MS-DOS and MS-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,
+Specifying <samp><span class="option">-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.
+on platforms other than MS-DOS and MS-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-127"></a><a
name="index-g_t_002d_002dnull_002ddata-128"></a><a
name="index-zero_002dterminated-lines-129"></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,
+ <br><dt><samp><span class="option">-z</span></samp><dt><samp><span
class="option">--null-data</span></samp><dd><a
name="index-g_t_002dz-127"></a><a
name="index-g_t_002d_002dnull_002ddata-128"></a><a
name="index-zero_002dterminated-lines-129"></a>Treat the input as a set of
lines, each terminated by a zero byte (the
+ASCII <code>NUL</code> character) instead of a newline.
+Like the <samp><span class="option">-Z</span></samp> or <samp><span
class="option">--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.
@@ -632,7 +650,41 @@
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>).
+with national language support (NLS).
+
+ <p>Many of the environment variables in the following list let you
+control highlighting using
+Select Graphic Rendition (SGR)
+commands interpreted by the terminal or terminal emulator.
+(See the
+section
+in the documentation of your text terminal
+for permitted values and their meanings 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.
+
+ <p>The two-letter names used in the <samp><span
class="env">GREP_COLORS</span></samp> environment variable
+(and some of the others) refer to terminal “capabilities,” the
ability
+of a terminal to highlight text, or change its color, and so on.
+These capabilities are stored in an online database and accessed by
+the <code>terminfo</code> library.
<p><a name="index-environment-variables-130"></a>
<dl>
@@ -648,20 +700,27 @@
A backslash escapes the next character, so it can be used to
specify an option containing whitespace or a backslash.
+ <p>The <code>GREP_OPTIONS</code> value does not affect whether
<samp><span class="command">grep</span></samp>
+without file operands searches standard input or the working
+directory; that is affected only by command-line options. For
+example, the command ‘<samp><span class="samp">grep
PAT</span></samp>’ searches standard input and the
+command ‘<samp><span class="samp">grep -r PAT</span></samp>’
searches the working directory, regardless
+of whether <code>GREP_OPTIONS</code> contains <samp><span
class="option">-r</span></samp>.
+
<br><dt><samp><span class="env">GREP_COLOR</span></samp><dd><a
name="index-GREP_005fCOLOR-_0040r_007benvironment-variable_007d-133"></a><a
name="index-highlight-markers-134"></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>
+It is deprecated in favor of <samp><span
class="env">GREP_COLORS</span></samp>, 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 <samp><span
class="env">GREP_COLORS</span></samp>
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).
+(a selected line when the <samp><span class="option">-v</span></samp>
command-line option is omitted,
+or a context line when <samp><span class="option">-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-135"></a><a
name="index-highlight-markers-136"></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
+Its value is a colon-separated list of <code>terminfo</code> 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.
@@ -669,45 +728,45 @@
<dl>
<dt><code>sl=</code><dd><a
name="index-sl-GREP_005fCOLORS-_0040r_007bcapability_007d-137"></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).
+matching lines when the <samp><span class="option">-v</span></samp>
command-line option is omitted,
+or non-matching lines when <samp><span class="option">-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,
+and the <samp><span class="option">-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-138"></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).
+non-matching lines when the <samp><span class="option">-v</span></samp>
command-line option is omitted,
+or matching lines when <samp><span class="option">-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,
+and the <samp><span class="option">-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-139"></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.
+when the <samp><span class="option">-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-140"></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).
+a selected line when the <samp><span class="option">-v</span></samp>
command-line option is omitted,
+or a context line when <samp><span class="option">-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-141"></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.)
+(This is used only when the <samp><span class="option">-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.
+remains active when this takes effect.
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-142"></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.)
+(This is used only when the <samp><span class="option">-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.
+remains active when this takes effect.
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-143"></a>SGR
substring for file names prefixing any content line.
@@ -732,7 +791,7 @@
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,
+(<code>bce</code>) boolean <code>terminfo</code> 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).
@@ -741,29 +800,6 @@
<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-148"></a><a
name="index-LC_005fCOLLATE-_0040r_007benvironment-variable_007d-149"></a><a
name="index-LANG-_0040r_007benvironment-variable_007d-150"></a><a
name="index-character-type-151"></a><a
name="index-national-language-support-152"></a><a
name="index-NLS-153"></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>’.
@@ -776,9 +812,9 @@
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-164"></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>
+ <br><dt><samp><span class="env">POSIXLY_CORRECT</span></samp><dd><a
name="index-POSIXLY_005fCORRECT-_0040r_007benvironment-variable_007d-164"></a>If
set, <samp><span class="command">grep</span></samp> behaves as POSIX requires;
otherwise,
+<samp><span class="command">grep</span></samp> behaves more like other GNU
programs.
+POSIX
requires that options that
follow file names must be treated as file names;
by default,
@@ -794,7 +830,7 @@
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,
+This behavior is available only with the GNU C library,
and only when <code>POSIXLY_CORRECT</code> is not set.
</dl>
@@ -815,7 +851,7 @@
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,
+Note, however, that POSIX 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,
@@ -832,27 +868,29 @@
<h3 class="section">2.4 <samp><span class="command">grep</span></samp>
Programs</h3>
-<p><a name="index-g_t_0040command_007bgrep_007d-programs-168"></a><a
name="index-variants-of-_0040command_007bgerp_007d-169"></a>
+<p><a name="index-g_t_0040command_007bgrep_007d-programs-168"></a><a
name="index-variants-of-_0040command_007bgrep_007d-169"></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.
+A file named <samp><span class="file">-</span></samp> stands for standard
input.
+If no input is specified, <samp><span class="command">grep</span></samp>
searches the working
+directory <samp><span class="file">.</span></samp> if given a command-line
option specifying
+recursion; otherwise, <samp><span class="command">grep</span></samp> searches
standard input.
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-170"></a><a
name="index-g_t_002d_002dbasic_002dregexp-171"></a><a
name="index-matching-basic-regular-expressions-172"></a>Interpret the pattern
as a basic regular expression (BRE).
+<dt><samp><span class="option">-G</span></samp><dt><samp><span
class="option">--basic-regexp</span></samp><dd><a
name="index-g_t_002dG-170"></a><a
name="index-g_t_002d_002dbasic_002dregexp-171"></a><a
name="index-matching-basic-regular-expressions-172"></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-173"></a><a
name="index-g_t_002d_002dextended_002dregexp-174"></a><a
name="index-matching-extended-regular-expressions-175"></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="option">-E</span></samp><dt><samp><span
class="option">--extended-regexp</span></samp><dd><a
name="index-g_t_002dE-173"></a><a
name="index-g_t_002d_002dextended_002dregexp-174"></a><a
name="index-matching-extended-regular-expressions-175"></a>Interpret the
pattern as an extended regular expression (ERE).
+(<samp><span class="option">-E</span></samp> is specified by POSIX.)
- <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-176"></a><a
name="index-g_t_002d_002dfixed_002dstrings-177"></a><a
name="index-matching-fixed-strings-178"></a>Interpret the pattern as a list of
fixed strings, separated
+ <br><dt><samp><span class="option">-F</span></samp><dt><samp><span
class="option">--fixed-strings</span></samp><dd><a
name="index-g_t_002dF-176"></a><a
name="index-g_t_002d_002dfixed_002dstrings-177"></a><a
name="index-matching-fixed-strings-178"></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>.)
+(<samp><span class="option">-F</span></samp> is specified by POSIX.)
- <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-179"></a><a
name="index-g_t_002d_002dperl_002dregexp-180"></a><a
name="index-matching-Perl-regular-expressions-181"></a>Interpret the pattern as
a Perl regular expression.
+ <br><dt><samp><span class="option">-P</span></samp><dt><samp><span
class="option">--perl-regexp</span></samp><dd><a
name="index-g_t_002dP-179"></a><a
name="index-g_t_002d_002dperl_002dregexp-180"></a><a
name="index-matching-Perl-regular-expressions-181"></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.
@@ -885,15 +923,15 @@
<samp><span class="command">grep</span></samp> understands
three different versions of regular expression syntax:
“basic,” (BRE) “extended” (ERE) and
“perl”.
-In <span class="sc">gnu</span> <samp><span class="command">grep</span></samp>,
-there is no difference in available functionality between basic and
+In GNU <samp><span class="command">grep</span></samp>,
+there is no difference in available functionality between the basic and
extended syntaxes.
In other implementations, basic regular expressions are less powerful.
The following description applies to extended regular expressions;
differences for basic regular expressions are summarized afterwards.
Perl regular expressions give additional functionality, and are
-documented in pcresyntax(3) and pcrepattern(3), but may not be
-available on every system.
+documented in the <i>pcresyntax</i>(3) and <i>pcrepattern</i>(3) manual pages,
+but may not be available on every system.
<ul class="menu">
<li><a accesskey="1" href="#Fundamental-Structure">Fundamental Structure</a>
@@ -944,14 +982,15 @@
</dl>
- <p>Two regular expressions may be concatenated;
+ <p>The empty regular expression matches the empty string.
+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.
+matches any string matching either alternate expression.
<p>Repetition takes precedence over concatenation,
which in turn takes precedence over alternation.
@@ -995,22 +1034,22 @@
<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.
+for example, ‘<samp><span class="samp">[[:alnum:]]</span></samp>’
means the character class of numbers and letters
+in the current locale.
<p><a name="index-classes-of-characters-210"></a><a
name="index-character-classes-211"></a>
<dl>
<dt>‘<samp><span class="samp">[:alnum:]</span></samp>’<dd><a
name="index-alnum-_0040r_007bcharacter-class_007d-212"></a><a
name="index-alphanumeric-characters-213"></a>Alphanumeric characters:
-‘<samp><span class="samp">[:alpha:]</span></samp>’ and
‘<samp><span class="samp">[:digit:]</span></samp>’.
+‘<samp><span class="samp">[:alpha:]</span></samp>’ and
‘<samp><span class="samp">[:digit:]</span></samp>’; in the
‘<samp><span class="samp">C</span></samp>’ locale and ASCII
character encoding, this is the same as ‘<samp><span
class="samp">[0-9A-Za-z]</span></samp>’.
<br><dt>‘<samp><span
class="samp">[:alpha:]</span></samp>’<dd><a
name="index-alpha-_0040r_007bcharacter-class_007d-214"></a><a
name="index-alphabetic-characters-215"></a>Alphabetic characters:
-‘<samp><span class="samp">[:lower:]</span></samp>’ and
‘<samp><span class="samp">[:upper:]</span></samp>’.
+‘<samp><span class="samp">[:lower:]</span></samp>’ and
‘<samp><span class="samp">[:upper:]</span></samp>’; in the
‘<samp><span class="samp">C</span></samp>’ locale and ASCII
character encoding, this is the same as ‘<samp><span
class="samp">[A-Za-z]</span></samp>’.
<br><dt>‘<samp><span
class="samp">[:blank:]</span></samp>’<dd><a
name="index-blank-_0040r_007bcharacter-class_007d-216"></a><a
name="index-blank-characters-217"></a>Blank characters:
space and tab.
<br><dt>‘<samp><span
class="samp">[:cntrl:]</span></samp>’<dd><a
name="index-cntrl-_0040r_007bcharacter-class_007d-218"></a><a
name="index-control-characters-219"></a>Control characters.
-In <span class="sc">ascii</span>, these characters have octal codes 000
+In ASCII, these characters have octal codes 000
through 037, and 177 (<code>DEL</code>).
In other character sets, these are
the equivalent characters, if any.
@@ -1020,32 +1059,32 @@
<br><dt>‘<samp><span
class="samp">[:graph:]</span></samp>’<dd><a
name="index-graph-_0040r_007bcharacter-class_007d-223"></a><a
name="index-graphic-characters-224"></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-225"></a><a
name="index-lower_002dcase-letters-226"></a>Lower-case letters:
+ <br><dt>‘<samp><span
class="samp">[:lower:]</span></samp>’<dd><a
name="index-lower-_0040r_007bcharacter-class_007d-225"></a><a
name="index-lower_002dcase-letters-226"></a>Lower-case letters; in the
‘<samp><span class="samp">C</span></samp>’ locale and ASCII
character
+encoding, this is
<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-227"></a><a
name="index-printable-characters-228"></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-229"></a><a
name="index-punctuation-characters-230"></a>Punctuation characters:
+ <br><dt>‘<samp><span
class="samp">[:punct:]</span></samp>’<dd><a
name="index-punct-_0040r_007bcharacter-class_007d-229"></a><a
name="index-punctuation-characters-230"></a>Punctuation characters; in the
‘<samp><span class="samp">C</span></samp>’ locale and ASCII
character
+encoding, this is
<code>! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | }
~</code>.
- <br><dt>‘<samp><span
class="samp">[:space:]</span></samp>’<dd><a
name="index-space-_0040r_007bcharacter-class_007d-231"></a><a
name="index-space-characters-232"></a><a
name="index-whitespace-characters-233"></a>Space characters:
+ <br><dt>‘<samp><span
class="samp">[:space:]</span></samp>’<dd><a
name="index-space-_0040r_007bcharacter-class_007d-231"></a><a
name="index-space-characters-232"></a><a
name="index-whitespace-characters-233"></a>Space characters: in the
‘<samp><span class="samp">C</span></samp>’ locale, this is
tab, newline, vertical tab, form feed, carriage return, and space.
See <a href="#Usage">Usage</a>, for more discussion of matching newlines.
- <br><dt>‘<samp><span
class="samp">[:upper:]</span></samp>’<dd><a
name="index-upper-_0040r_007bcharacter-class_007d-234"></a><a
name="index-upper_002dcase-letters-235"></a>Upper-case letters:
+ <br><dt>‘<samp><span
class="samp">[:upper:]</span></samp>’<dd><a
name="index-upper-_0040r_007bcharacter-class_007d-234"></a><a
name="index-upper_002dcase-letters-235"></a>Upper-case letters: in the
‘<samp><span class="samp">C</span></samp>’ locale and ASCII
character
+encoding, this is
<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-236"></a><a
name="index-xdigit-class-237"></a><a
name="index-hexadecimal-digits-238"></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
+ 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.)
+the brackets delimiting the bracket expression.
<p><a name="invalid_002dbracket_002dexpr"></a>If you mistakenly omit the
outer brackets, and search for say, ‘<samp><span
class="samp">[:upper:]</span></samp>’,
GNU <samp><span class="command">grep</span></samp> prints a diagnostic and
exits with status 2, on
@@ -1098,21 +1137,21 @@
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.
+<dt>‘<samp><span class="samp">\b</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">\B</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>’<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>’<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">\w</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>’.
+ <br><dt>‘<samp><span class="samp">\W</span></samp>’<dd>Match
non-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">\s</span></samp><span
class="samp">’</span></samp>’<dd>Match whitespace, it is a synonym
for ‘<samp><span class="samp">[[:space:]]</span></samp>’.
+ <br><dt>‘<samp><span class="samp">\s</span></samp>’<dd>Match
whitespace, it is a synonym for ‘<samp><span
class="samp">[[:space:]]</span></samp>’.
- <br><dt>‘<samp><span class="samp">‘</span><samp><span
class="samp">\S</span></samp><span
class="samp">’</span></samp>’<dd>Match non-whitespace, it is a
synonym for ‘<samp><span class="samp">[^[:space:]]</span></samp>’.
+ <br><dt>‘<samp><span class="samp">\S</span></samp>’<dd>Match
non-whitespace, it is a synonym for ‘<samp><span
class="samp">[^[:space:]]</span></samp>’.
</dl>
@@ -1133,6 +1172,8 @@
<p><a name="index-anchoring-240"></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.
+They are termed <dfn>anchors</dfn>, since they force the match to be
“anchored”
+to beginning or end of a line, respectively.
<div class="node">
<a name="Back-references-and-Subexpressions"></a>
@@ -1156,7 +1197,7 @@
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>’),
+<samp><span class="option">-e</span></samp> or from a file (‘<samp><span
class="samp">-f </span><var>file</var></samp>’),
back-references are local to each expression.
<div class="node">
@@ -1180,13 +1221,13 @@
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
+ <p>GNU <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
+POSIX allows this behavior as an extension, but portable scripts
should avoid it.
<div class="node">
@@ -1200,7 +1241,7 @@
<h2 class="chapter">4 Usage</h2>
-<p><a name="index-usage_002c-examples-245"></a>Here is an example command that
invokes <span class="sc">gnu</span> <samp><span
class="command">grep</span></samp>:
+<p><a name="index-usage_002c-examples-245"></a>Here is an example command that
invokes GNU <samp><span class="command">grep</span></samp>:
<pre class="example"> grep -i 'hello.*world' menu.h main.c
</pre>
@@ -1208,7 +1249,7 @@
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>
+The <samp><span class="option">-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
@@ -1239,13 +1280,10 @@
</pre>
<p>This differs from the command:
- <pre class="example"> grep -rH 'hello' *.c
+ <pre class="example"> grep -H '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
@@ -1255,7 +1293,7 @@
<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>’,
+Without <samp><span class="option">-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.
@@ -1290,7 +1328,7 @@
<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:
+ <p>Alternatively, use <samp><span class="option">-H</span></samp>, which
is a GNU extension:
<pre class="example"> grep -H 'eli' /etc/passwd
</pre>
@@ -1311,13 +1349,13 @@
<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
+So GNU <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 force GNU <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.
+<samp><span class="option">-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
+“Binary file matches” messages, use the <samp><span
class="option">-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?
@@ -1325,15 +1363,27 @@
<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>’
+matching lines, use the <samp><span class="option">-L</span></samp> or
<samp><span class="option">--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>?
+ <li>I can do “OR” with ‘<samp><span
class="samp">|</span></samp>’, but what about “AND”?
<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>Why does the empty pattern match every input line?
+
+ <p>The <samp><span class="command">grep</span></samp> command searches
for lines that contain strings
+that match a pattern. Every line contains the empty string, so an
+empty pattern causes <samp><span class="command">grep</span></samp> to find a
match on each line. It
+is not the only such pattern: ‘<samp><span
class="samp">^</span></samp>’, ‘<samp><span
class="samp">$</span></samp>’, ‘<samp><span
class="samp">.*</span></samp>’, and many
+other patterns cause <samp><span class="command">grep</span></samp> to match
every line.
+
+ <p>To match empty lines, use the pattern ‘<samp><span
class="samp">^$</span></samp>’. To match blank
+lines, use the pattern ‘<samp><span
class="samp">^[[:blank:]]*$</span></samp>’. To match no lines at
+all, use the command ‘<samp><span class="samp">grep -f
/dev/null</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>’:
@@ -1348,7 +1398,7 @@
<pre class="example"> grep -w -e '\(.\)\(.\).\2\1' file
</pre>
- <p>It matches the word "radar" or "civic".
+ <p>It matches the word “radar” or “civic.”
<p>Guglielmo Bondioni proposed a single RE
that finds all palindromes up to 19 characters long
@@ -1356,7 +1406,7 @@
<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;
+ <p>Note this is done by using GNU 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?
@@ -1446,13 +1496,13 @@
<h2 class="chapter">6 Copying</h2>
<p><a name="index-copying-251"></a>
-GNU grep is licensed under the GNU GPL, which makes it <dfn>free
+GNU <samp><span class="command">grep</span></samp> 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
+run and change <samp><span class="command">grep</span></samp> 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.
@@ -1485,7 +1535,7 @@
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
-<pre class="display"> Copyright © 2000-2002, 2007-2008, 2010-2011
Free Software
+<pre class="display"> Copyright © 2000-2002, 2007-2008, 2010-2012
Free Software
Foundation, Inc.
<a href="http://fsf.org/">http://fsf.org/</a>
@@ -2058,7 +2108,7 @@
<li><a href="#index-basic-regular-expressions-243">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-95">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-126">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-binary-files_002c-MS_002dDOS_002fMS_002dWindows-126">binary files,
MS-DOS/MS-Windows</a>: <a href="#Other-Options">Other Options</a></li>
<li><a href="#index-blank-_0040r_007bcharacter-class_007d-216"><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-217">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-145"><code>bn
GREP_COLORS </code><span class="roman">capability</span></a>: <a
href="#Environment-Variables">Environment Variables</a></li>
@@ -2070,7 +2120,7 @@
<li><a href="#index-Bugs_002c-known-250">Bugs, known</a>: <a
href="#Reporting-Bugs">Reporting Bugs</a></li>
<li><a href="#index-bugs_002c-reporting-249">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-byte-offsets_002c-on-MS_002dDOS_002fMS_002dWindows-72">byte
offsets, on MS-DOS/MS-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-208">character class</a>: <a
href="#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket
Expressions</a></li>
@@ -2140,8 +2190,8 @@
<li><a href="#index-memory-mapped-input-122">memory mapped input</a>: <a
href="#Other-Options">Other Options</a></li>
<li><a href="#index-message-language-161">message language</a>: <a
href="#Environment-Variables">Environment Variables</a></li>
<li><a
href="#index-ms-GREP_005fCOLORS-_0040r_007bcapability_007d-141"><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-125"><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-MS_002dDOS_002fMS_002dWindows-binary-files-125">MS-DOS/MS-Windows
binary files</a>: <a href="#Other-Options">Other Options</a></li>
+<li><a
href="#index-MS_002dDOS_002fMS_002dWindows-byte-offsets-71">MS-DOS/MS-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-140"><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-152">national language
support</a>: <a href="#Environment-Variables">Environment Variables</a></li>
@@ -2183,7 +2233,7 @@
<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-245">usage, examples</a>: <a
href="#Usage">Usage</a></li>
<li><a href="#index-using-_0040command_007bgrep_007d_002c-Q_0026A-246">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-169">variants of
<samp><span class="command">gerp</span></samp></a>: <a
href="#grep-Programs">grep Programs</a></li>
+<li><a href="#index-variants-of-_0040command_007bgrep_007d-169">variants of
<samp><span class="command">grep</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-233">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>
@@ -2195,5 +2245,12 @@
<li><a
href="#index-g_t_0040_007b_0040var_007bn_007d_002c_0040var_007bm_007d_0040_007d-204"><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-198"><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-195"><code>{</code><var>n</var><code>}</code></a>:
<a href="#Fundamental-Structure">Fundamental Structure</a></li>
- </ul></body></html>
+ </ul><div class="footnote">
+<hr>
+<a name="texinfo-footnotes-in-document"></a><h4>Footnotes</h4><p
class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> Of course,
7th Edition
+Unix predated POSIX by several years!</p>
+
+ <hr></div>
+
+</body></html>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to grep/manual/grep.html,v,
Jim Meyering <=