[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to grep/manual/grep.txt,v
From: |
Jim Meyering |
Subject: |
Changes to grep/manual/grep.txt,v |
Date: |
Sat, 3 Sep 2022 15:33:15 -0400 (EDT) |
CVSROOT: /webcvs/grep
Module name: grep
Changes by: Jim Meyering <meyering> 22/09/03 15:33:15
Index: grep.txt
===================================================================
RCS file: /webcvs/grep/grep/manual/grep.txt,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- grep.txt 14 Aug 2021 20:46:39 -0000 1.32
+++ grep.txt 3 Sep 2022 19:33:14 -0000 1.33
@@ -15,12 +15,13 @@
3 Regular Expressions
3.1 Fundamental Structure
3.2 Character Classes and Bracket Expressions
- 3.3 The Backslash Character and Special Expressions
+ 3.3 Special Backslash Expressions
3.4 Anchoring
3.5 Back-references and Subexpressions
3.6 Basic vs Extended Regular Expressions
- 3.7 Character Encoding
- 3.8 Matching Non-ASCII and Non-printable Characters
+ 3.7 Problematic Regular Expressions
+ 3.8 Character Encoding
+ 3.9 Matching Non-ASCII and Non-printable Characters
4 Usage
5 Performance
6 Reporting bugs
@@ -33,11 +34,11 @@
âgrepâ prints lines that contain a match for one or more patterns.
- This manual is for version 3.7 of GNU Grep.
+ This manual is for version 3.8 of GNU Grep.
This manual is for âgrepâ, a pattern matching engine.
- Copyright © 1999â2002, 2005, 2008â2021 Free Software Foundation, Inc.
+ Copyright © 1999â2002, 2005, 2008â2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
@@ -164,8 +165,8 @@
and end with word constituents, it differs from surrounding a
regular expression with â\<â and â\>â. For example, although
âgrep
-w @â matches a line containing only â@â, âgrep '\<@\>'â cannot
- match any line because â@â is not a word constituent. *Note The
- Backslash Character and Special Expressions::.
+ match any line because â@â is not a word constituent. *Note
+ Special Backslash Expressions::.
â-xâ
â--line-regexpâ
@@ -185,18 +186,22 @@
â--color[=WHEN]â
â--colour[=WHEN]â
- 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 âGREP_COLORSâ and default to
+ Surround matched non-empty strings, matching lines, context lines,
+ file names, line numbers, byte offsets, and separators (for fields
+ and groups of context lines) with escape sequences to display them
+ in color on the terminal. The colors are defined by the
+ environment variable âGREP_COLORSâ and default to
âms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36â 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 âGREP_COLORâ 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.
- WHEN is âneverâ, âalwaysâ, or âautoâ.
+ *Note Environment Variables::.
+
+ WHEN is âalwaysâ to use colors, âneverâ to not use colors, or
+ âautoâ to use colors if standard output is associated with a
+ terminal device and the âTERMâ environment variableâs value
+ suggests that the terminal supports colors. Plain â--colorâ is
+ treated like â--color=autoâ; if no â--colorâ option is given, the
+ default is â--color=neverâ.
â-Lâ
â--files-without-matchâ
@@ -211,12 +216,16 @@
â-m NUMâ
â--max-count=NUMâ
- Stop after the first NUM selected lines. If the input is standard
- input from a regular file, and NUM selected lines are output,
- âgrepâ ensures that the standard input is positioned just after the
- last selected line before exiting, regardless of the presence of
- trailing context lines. This enables a calling process to resume a
- search. For example, the following shell script makes use of it:
+ Stop after the first NUM selected lines. If NUM is zero, âgrepâ
+ stops right away without reading input. A NUM of â1 is treated as
+ infinity and âgrepâ does not stop; this is the default.
+
+ If the input is standard input from a regular file, and NUM
+ selected lines are output, âgrepâ ensures that the standard input
+ is positioned just after the last selected line before exiting,
+ regardless of the presence of trailing context lines. This enables
+ a calling process to resume a search. For example, the following
+ shell script makes use of it:
while grep -m 1 'PATTERN'
do
@@ -241,9 +250,9 @@
â-oâ
â--only-matchingâ
- Print only the matched (non-empty) parts of matching lines, with
- each such part on a separate output line. Output lines use the
- same delimiters as input, and delimiters are null bytes if â-zâ
+ Print only the matched non-empty parts of matching lines, with each
+ such part on a separate output line. Output lines use the same
+ delimiters as input, and delimiters are null bytes if â-zâ
(â--null-dataâ) is also used (*note Other Options::).
â-qâ
@@ -251,23 +260,15 @@
â--silentâ
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 â-sâ or â--no-messagesâ option.
(â-qâ is
- specified by POSIX.)
+ detected. Also see the â-sâ or â--no-messagesâ option.
+ Portability note: Solaris 10 âgrepâ lacks â-qâ; portable shell
+ scripts typically can redirect standard output to â/dev/nullâ
+ instead of using â-qâ. (â-qâ is specified by POSIX.)
â-sâ
â--no-messagesâ
Suppress error messages about nonexistent or unreadable files.
- Portability note: unlike GNU âgrepâ, 7th Edition Unix âgrepâ did
- not conform to POSIX, because it lacked â-qâ and its â-sâ option
- behaved like GNU âgrepââs â-qâ option.(1) USG-style âgrepâ
also
- lacked â-qâ but its â-sâ option behaved like GNU âgrepââs.
- Portable shell scripts should avoid both â-qâ and â-sâ and should
- redirect standard and error output to â/dev/nullâ instead. (â-sâ
- is specified by POSIX.)
-
- ---------- Footnotes ----------
-
- (1) Of course, 7th Edition Unix predated POSIX by several years!
+ (â-sâ is specified by POSIX.)
2.1.4 Output Line Prefix Control
--------------------------------
@@ -397,8 +398,8 @@
By default, TYPE is âbinaryâ, and âgrepâ suppresses output after
null input binary data is discovered, and suppresses output lines
that contain improperly encoded data. When some output is
- suppressed, âgrepâ follows any output with a one-line message
- saying that a binary file matches.
+ suppressed, âgrepâ follows any output with a message to standard
+ error saying that a binary file matches.
If TYPE is âwithout-matchâ, when âgrepâ discovers null input
binary
data it assumes that the rest of the file does not match; this is
@@ -539,62 +540,59 @@
2.2 Environment Variables
=========================
-The behavior of âgrepâ is affected by the following environment
-variables.
+The behavior of âgrepâ is affected by several environment variables, the
+most important of which control the locale, which specifies how âgrepâ
+interprets characters in its patterns and data.
The locale for category âLC_FOOâ is specified by examining the three
environment variables âLC_ALLâ, âLC_FOOâ, and âLANGâ, in that
order.
The first of these variables that is set specifies the locale. For
-example, if âLC_ALLâ is not set, but âLC_COLLATEâ is set to
âpt_BRâ,
-then the Brazilian Portuguese locale is used for the âLC_COLLATEâ
-category. As a special case for âLC_MESSAGESâ only, the environment
-variable âLANGUAGEâ can contain a colon-separated list of languages that
-overrides the three environment variables that ordinarily specify the
-âLC_MESSAGESâ category. The âCâ locale is used if none of these
-environment variables are set, if the locale catalog is not installed,
-or if âgrepâ was not compiled with national language support (NLS). The
-shell command âlocale -aâ lists locales that are currently available.
-
- 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.
-âgrepâ takes care of assembling the result into a complete SGR sequence
-(â\33[â...âmâ). Common values to concatenate include â1â for
bold, â4â
-for underline, â5â for blink, â7â for inverse, â39â for default
-foreground color, â30â to â37â for foreground colors, â90â to
â97â for
-16-color mode foreground colors, â38;5;0â to â38;5;255â for 88-color
and
-256-color modes foreground colors, â49â for default background color,
-â40â to â47â for background colors, â100â to â107â for
16-color mode
-background colors, and â48;5;0â to â48;5;255â for 88-color and
256-color
-modes background colors.
-
- The two-letter names used in the âGREP_COLORSâ 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
-âterminfoâ library.
+example, if âLC_ALLâ is not set, but âLC_COLLATEâ is set to
+âpt_BR.UTF-8â, then a Brazilian Portuguese locale is used for the
+âLC_COLLATEâ category. As a special case for âLC_MESSAGESâ only, the
+environment variable âLANGUAGEâ can contain a colon-separated list of
+languages that overrides the three environment variables that ordinarily
+specify the âLC_MESSAGESâ category. The âCâ locale is used if none of
+these environment variables are set, if the locale catalog is not
+installed, or if âgrepâ was not compiled with national language support
+(NLS). The shell command âlocale -aâ lists locales that are currently
+available.
+
+ The following environment variables affect the behavior of âgrepâ.
âGREP_COLORâ
- This variable specifies the color used to highlight matched
- (non-empty) text. It is deprecated in favor of âGREP_COLORSâ, but
- still supported. The âmtâ, âmsâ, and âmcâ capabilities of
- âGREP_COLORSâ 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 â-vâ command-line option is omitted, or a
- context line when â-vâ is specified). The default is â01;31â,
- which means a bold red foreground text on the terminalâs default
- background.
+ This obsolescent variable interacts with âGREP_COLORSâ confusingly,
+ and âgrepâ warns if it is set and is not overridden by
+ âGREP_COLORSâ. Instead of âGREP_COLOR='COLOR'â, you can use
+ âGREP_COLORS='mt=COLOR'â.
âGREP_COLORSâ
This variable specifies the colors and other attributes used to
highlight various parts of the output. Its value is a
colon-separated list of âterminfoâ capabilities that defaults to
âms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36â with the ârvâ
- and âneâ boolean capabilities omitted (i.e., false). Supported
- capabilities are as follows.
+ and âneâ boolean capabilities omitted (i.e., false). The
+ two-letter capability names 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 âterminfoâ library. Non-empty capability values
+ 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. âgrepâ takes care of assembling the result into a
+ complete SGR sequence (â\33[â...âmâ). Common values to
concatenate
+ include â1â for bold, â4â for underline, â5â for blink,
â7â for
+ inverse, â39â for default foreground color, â30â to â37â for
+ foreground colors, â90â to â97â for 16-color mode foreground
+ colors, â38;5;0â to â38;5;255â for 88-color and 256-color modes
+ foreground colors, â49â for default background color, â40â to
â47â
+ for background colors, â100â to â107â for 16-color mode background
+ colors, and â48;5;0â to â48;5;255â for 88-color and 256-color
modes
+ background colors.
+
+ Supported capabilities are as follows.
âsl=â
SGR substring for whole selected lines (i.e., matching lines
@@ -682,7 +680,7 @@
âLC_COLLATEâ
âLANGâ
These variables specify the locale for the âLC_COLLATEâ category,
- which might affect how range expressions like â[a-z]â are
+ which might affect how range expressions like âa-zâ are
interpreted.
âLC_ALLâ
@@ -706,9 +704,11 @@
more like other GNU programs. POSIX requires that options that
follow file names must be treated as file names; by default, such
options are permuted to the front of the operand list and are
- treated as options. Also, âPOSIXLY_CORRECTâ disables special
- handling of an invalid bracket expression. *Note
- invalid-bracket-expr::.
+ treated as options.
+
+âTERMâ
+ This variable specifies the output terminal type, which can affect
+ what the â--colorâ option does. *Note General Output Control::.
â_N_GNU_nonoption_argv_flags_â
(Here âNâ is âgrepââs numeric process ID.) If the Ith character
of
@@ -773,12 +773,6 @@
âgrep -Pâ may warn of unimplemented features. *Note Other
Options::.
- In addition, two variant programs âegrepâ and âfgrepâ are available.
-âegrepâ is the same as âgrep -Eâ. âfgrepâ is the same as âgrep
-Fâ.
-Direct invocation as either âegrepâ or âfgrepâ is deprecated, but is
-provided to allow historical applications that rely on them to run
-unmodified.
-
3 Regular Expressions
*********************
@@ -787,13 +781,13 @@
expressions, by using various operators to combine smaller expressions.
âgrepâ understands three different versions of regular expression
syntax: basic (BRE), extended (ERE), and Perl-compatible (PCRE). In GNU
-âgrepâ, there is no difference in available functionality between the
-basic and extended syntaxes. In other implementations, basic regular
+âgrepâ, there is no difference in available functionality between basic
+and extended syntax. In other implementations, basic regular
expressions are less powerful. The following description applies to
extended regular expressions; differences for basic regular expressions
are summarized afterwards. Perl-compatible regular expressions give
-additional functionality, and are documented in the pcresyntax(3) and
-pcrepattern(3) manual pages, but work only if PCRE is available in the
+additional functionality, and are documented in the pcre2syntax(3) and
+pcre2pattern(3) manual pages, but work only if PCRE is available in the
system.
3.1 Fundamental Structure
@@ -839,15 +833,18 @@
matches any string formed by concatenating two substrings that
respectively match the concatenated expressions.
- Two regular expressions may be joined by the infix operator â|â; the
-resulting regular expression matches any string matching either
-alternate expression.
+ Two regular expressions may be joined by the infix operator â|â. The
+resulting regular expression matches any string matching either of the
+two expressions, which are called âalternativesâ.
Repetition takes precedence over concatenation, which in turn takes
precedence over alternation. A whole expression may be enclosed in
parentheses to override these precedence rules and form a subexpression.
An unmatched â)â matches just itself.
+ Not every character string is a valid regular expression. *Note
+Problematic Expressions::.
+
3.2 Character Classes and Bracket Expressions
=============================================
@@ -866,9 +863,10 @@
is equivalent to â[abcd]â. In other locales, the sorting sequence is
not specified, and â[a-d]â might be equivalent to â[abcd]â or to
â[aBbCcDd]â, or it might fail to match any character, or the set of
-characters that it matches might even be erratic. To obtain the
-traditional interpretation of bracket expressions, you can use the âCâ
-locale by setting the âLC_ALLâ environment variable to the value âCâ.
+characters that it matches might be erratic, or it might be invalid. To
+obtain the traditional interpretation of bracket expressions, you can
+use the âCâ locale by setting the âLC_ALLâ environment variable to the
+value âCâ.
Finally, certain named classes of characters are predefined within
bracket expressions, as follows. Their interpretation depends on the
@@ -929,9 +927,8 @@
If you mistakenly omit the outer brackets, and search for say,
â[:upper:]â, GNU âgrepâ prints a diagnostic and exits with status 2, on
-the assumption that you did not intend to search for the nominally
-equivalent regular expression: â[:epru]â. Set the âPOSIXLY_CORRECTâ
-environment variable to disable this feature.
+the assumption that you did not intend to search for the regular
+expression â[:epru]â.
Special characters lose their special meaning inside bracket
expressions.
@@ -962,14 +959,15 @@
â-â
represents the range if itâs not first or last in a list or the
- ending point of a range.
+ ending point of a range. To make the â-â a list item, it is best
+ to put it last.
â^â
represents the characters not in the list. If you want to make the
â^â character a list item, place it anywhere but first.
-3.3 The Backslash Character and Special Expressions
-===================================================
+3.3 Special Backslash Expressions
+=================================
The â\â character followed by a special character is a regular
expression that matches the special character. The â\â character, when
@@ -999,9 +997,21 @@
â\Sâ
Match non-whitespace, it is a synonym for â[^[:space:]]â.
+â\]â
+ Match â]â.
+
+â\}â
+ Match â}â.
+
For example, â\brat\bâ matches the separate word âratâ,
â\Brat\Bâ
matches âcrateâ but not âfurry ratâ.
+ The behavior of âgrepâ is unspecified if a unescaped backslash is not
+followed by a special character, a nonzero digit, or a character in the
+above list. Although âgrepâ might issue a diagnostic and/or give the
+backslash an interpretation now, its behavior may change if the syntax
+of regular expressions is extended in future versions.
+
3.4 Anchoring
=============
@@ -1029,40 +1039,142 @@
3.6 Basic vs Extended Regular Expressions
=========================================
-In basic regular expressions the characters â?â, â+â, â{â,
â|â, â(â, and
-â)â lose their special meaning; instead use the backslashed versions
-â\?â, â\+â, â\{â, â\|â, â\(â, and â\)â. Also, a
backslash is needed
-before an interval expressionâs closing â}â, and an unmatched â\)â is
+Basic regular expressions differ from extended regular expressions in
+the following ways:
+
+ ⢠The characters â?â, â+â, â{â, â|â, â(â, and â)â
lose their special
+ meaning; instead use the backslashed versions â\?â, â\+â,
â\{â,
+ â\|â, â\(â, and â\)â. Also, a backslash is needed before an
+ interval expressionâs closing â}â.
+
+ ⢠An unmatched â\)â is invalid.
+
+ ⢠If an unescaped â^â appears neither first, nor directly after
â\(â
+ or â\|â, it is treated like an ordinary character and is not an
+ anchor.
+
+ ⢠If an unescaped â$â appears neither last, nor directly before
â\|â
+ or â\)â, it is treated like an ordinary character and is not an
+ anchor.
+
+ ⢠If an unescaped â*â appears first, or appears directly after
â\(â
+ or â\|â or anchoring â^â, it is treated like an ordinary character
+ and is not a repetition operator.
+
+3.7 Problematic Regular Expressions
+===================================
+
+Some strings are âinvalid regular expressionsâ and cause âgrepâ to
issue
+a diagnostic and fail. For example, âxy\1â is invalid because there is
+no parenthesized subexpression for the back-reference â\1â to refer to.
+
+ Also, some regular expressions have âunspecified behaviorâ and should
+be avoided even if âgrepâ does not currently diagnose them. For
+example, âxy\0â has unspecified behavior because â0â is not a special
+character and â\0â is not a special backslash expression (*note Special
+Backslash Expressions::). Unspecified behavior can be particularly
+problematic because the set of matched strings might be only partially
+specified, or not be specified at all, or the expression might even be
invalid.
- Portable scripts should avoid the following constructs, as POSIX says
-they produce undefined results:
+ The following regular expression constructs are invalid on all
+platforms conforming to POSIX, so portable scripts can assume that
+âgrepâ rejects these constructs:
+
+ ⢠A basic regular expression containing a back-reference â\Nâ
+ preceded by fewer than N closing parentheses. For example,
+ â\(a\)\2â is invalid.
+
+ ⢠A bracket expression containing â[:â that does not start a
+ character class; and similarly for â[=â and â[.â. For example,
+ â[a[:b]â and â[a[:ouch:]b]â are invalid.
+
+ GNU âgrepâ treats the following constructs as invalid. However,
+other âgrepâ implementations might allow them, so portable scripts
+should not rely on their being invalid:
+
+ ⢠Unescaped â\â at the end of a regular expression.
+
+ ⢠Unescaped â[â that does not start a bracket expression.
- ⢠Extended regular expressions that use back-references.
- ⢠Basic regular expressions that use â\?â, â\+â, or â\|â.
- ⢠Empty parenthesized regular expressions like â()â.
- ⢠Empty alternatives (as in, e.g, âa|â).
- ⢠Repetition operators that immediately follow empty expressions,
- unescaped â$â, or other repetition operators.
- ⢠A backslash escaping an ordinary character (e.g., â\Sâ), unless it
- is a back-reference.
- ⢠An unescaped â[â that is not part of a bracket expression.
- ⢠In extended regular expressions, an unescaped â{â that is not part
- of an interval expression.
-
- Traditional âegrepâ did not support interval expressions and some
-âegrepâ implementations use â\{â and â\}â instead, so portable
scripts
-should avoid interval expressions in âgrep -Eâ patterns and should use
-â[{]â to match a literal â{â.
-
- GNU âgrep -Eâ attempts to support traditional usage by assuming that
-â{â is not special if it would be the start of an invalid interval
-expression. For example, the command âgrep -E '{1'â searches for the
-two-character string â{1â instead of reporting a syntax error in the
-regular expression. POSIX allows this behavior as an extension, but
-portable scripts should avoid it.
+ ⢠A â\{â in a basic regular expression that does not start an
+ interval expression.
-3.7 Character Encoding
+ ⢠A basic regular expression with unbalanced â\(â or â\)â, or an
+ extended regular expression with unbalanced â(â.
+
+ ⢠In the POSIX locale, a range expression like âz-aâ that represents
+ zero elements. A non-GNU âgrepâ might treat it as a valid range
+ that never matches.
+
+ ⢠An interval expression with a repetition count greater than 32767.
+ (The portable POSIX limit is 255, and even interval expressions
+ with smaller counts can be impractically slow on all known
+ implementations.)
+
+ ⢠A bracket expression that contains at least three elements, the
+ first and last of which are both â:â, or both â.â, or both
â=â.
+ For example, a non-GNU âgrepâ might treat â[:alpha:]â like
+ â[[:alpha:]]â, or like â[:ahlp]â.
+
+ The following constructs have well-defined behavior in GNU âgrepâ.
+However, they have unspecified behavior elsewhere, so portable scripts
+should avoid them:
+
+ ⢠Special backslash expressions like â\bâ, â\<â, and â\]â.
*Note
+ Special Backslash Expressions::.
+
+ ⢠A basic regular expression that uses â\?â, â\+â, or â\|â.
+
+ ⢠An extended regular expression that uses back-references.
+
+ ⢠An empty regular expression, subexpression, or alternative. For
+ example, â(a|bc|)â is not portable; a portable equivalent is
+ â(a|bc)?â.
+
+ ⢠In a basic regular expression, an anchoring â^â that appears
+ directly after â\(â, or an anchoring â$â that appears directly
+ before â\)â.
+
+ ⢠In a basic regular expression, a repetition operator that directly
+ follows another repetition operator.
+
+ ⢠In an extended regular expression, unescaped â{â that does not
+ begin a valid interval expression. GNU âgrepâ treats the â{â as
an
+ ordinary character.
+
+ ⢠A null character or an encoding error in either pattern or input
+ data. *Note Character Encoding::.
+
+ ⢠An input file that ends in a non-newline character, where GNU
+ âgrepâ silently supplies a newline.
+
+ The following constructs have unspecified behavior, in both GNU and
+other âgrepâ implementations. Scripts should avoid them whenever
+possible.
+
+ ⢠A backslash escaping an ordinary character, unless it is a
+ back-reference like â\1â or a special backslash expression like
+ â\<â or â\bâ. *Note Special Backslash Expressions::. For
example,
+ â\xâ has unspecified behavior now, and a future version of âgrepâ
+ might specify â\xâ to have a new behavior.
+
+ ⢠A repetition operator that appears directly after an anchor, or at
+ the start of a complete regular expression, parenthesized
+ subexpression, or alternative. For example, â+|^*(+a|?-b)â has
+ unspecified behavior, whereas â\+|^\*(\+a|\?-b)â is portable.
+
+ ⢠A range expression outside the POSIX locale. For example, in some
+ locales â[a-z]â might match some characters that are not lowercase
+ letters, or might not match some lowercase letters, or might be
+ invalid. With GNU âgrepâ it is not documented whether these range
+ expressions use native code points, or use the collating sequence
+ specified by the âLC_COLLATEâ category, or have some other
+ interpretation. Outside the POSIX locale, it is portable to use
+ â[[:lower:]]â to match a lower-case letter, or
+ â[abcdefghijklmnopqrstuvwxyz]â to match an ASCII lower-case letter.
+
+3.8 Character Encoding
======================
The âLC_CTYPEâ locale specifies the encoding of characters in patterns
@@ -1087,7 +1199,7 @@
and the 128 ASCII characters have their usual single-byte encodings on
all but oddball platforms.
-3.8 Matching Non-ASCII and Non-printable Characters
+3.9 Matching Non-ASCII and Non-printable Characters
===================================================
In a regular expression, non-ASCII and non-printable characters other
@@ -1179,19 +1291,29 @@
grep -r --include='*.c' 'hello' /home/gigi
- 3. What if a pattern or file has a leading â-â?
+ 3. What if a pattern or file has a leading â-â? For example:
+
+ grep "$pattern" *
+
+ can behave unexpectedly if the value of âpatternâ begins with â-â,
+ or if the â*â expands to a file name with leading â-â. To avoid
+ the problem, you can use â-eâ for patterns and leading â./â for
+ files:
+
+ grep -e "$pattern" ./*
- grep -- '--cut here--' *
+ searches for all lines matching the pattern in all the working
+ directoryâs files whose names do not begin with â.â. Without the
+ â-eâ, âgrepâ might treat the pattern as an option if it begins
with
+ â-â. Without the â./â, there might be similar problems with file
+ names beginning with â-â.
- searches for all lines matching â--cut here--â. Without â--â,
- âgrepâ would attempt to parse â--cut here--â as a list of options,
- and there would be similar problems with any file names beginning
- with â-â.
+ Alternatively, you can use â--â before the pattern and file names:
- Alternatively, you can prevent misinterpretation of leading â-â by
- using â-eâ for patterns and leading â./â for files:
+ grep -- "$pattern" *
- grep -e '--cut here--' ./*
+ This also fixes the problem, except that if there is a file named
+ â-â, âgrepâ misinterprets the â-â as standard input.
4. Suppose I want to search for a whole word, not a part of a word?
@@ -1245,7 +1367,7 @@
even from files that appear to be binary, use the â-aâ or
â--binary-files=textâ option. To eliminate the âBinary file
matchesâ messages, use the â-Iâ or
â--binary-files=without-matchâ
- option, or the â-sâ or â--no-messagesâ option.
+ option.
9. Why doesnât âgrep -lvâ print non-matching file names?
@@ -1269,8 +1391,11 @@
to match every line.
To match empty lines, use the pattern â^$â. To match blank lines,
- use the pattern â^[[:blank:]]*$â. To match no lines at all, use
- the command âgrep -f /dev/nullâ.
+ use the pattern â^[[:blank:]]*$â. To match no lines at all, use an
+ extended regular expression like âa^â or â$aâ. To match every
+ line, a portable script should use a pattern like â^â instead of
+ the empty pattern, as POSIX does not specify the behavior of the
+ empty pattern.
12. How can I search in both standard input and in files?
@@ -1278,14 +1403,28 @@
cat /etc/passwd | grep 'alain' - /etc/motd
- 13. Why is this back-reference failing?
+ 13. Why canât I combine the shellâs âset -eâ with âgrepâ?
+
+ The âgrepâ command follows the convention of programs like âcmpâ
+ and âdiffâ where an exit status of 1 is not an error. The shell
+ command âset -eâ causes the shell to exit if any subcommand exits
+ with nonzero status, and this will cause the shell to exit merely
+ because âgrepâ selected no lines, which is ordinarily not what you
+ want.
+
+ There is a related problem with Bashâs âset -e -o pipefailâ. Since
+ âgrepâ does not always read all its input, a command outputting to
+ a pipe read by âgrepâ can fail when âgrepâ exits before reading
all
+ its input, and the commandâs failure can cause Bash to exit.
+
+ 14. Why is this back-reference failing?
echo 'ba' | grep -E '(a)\1|b\1'
This outputs an error message, because the second â\1â has nothing
to refer back to, meaning it will never match anything.
- 14. How can I match across lines?
+ 15. How can I match across lines?
Standard grep cannot do this, as it is fundamentally line-based.
Therefore, merely using the â[:space:]â character class does not
@@ -1303,7 +1442,7 @@
it to âgrepâ, or turn to âawkâ, âsedâ, âperlâ, or many
other
utilities that are designed to operate across lines.
- 15. What do âgrepâ, âfgrepâ, and âegrepâ stand for?
+ 16. What do âgrepâ, â-Eâ, and â-Fâ stand for?
The name âgrepâ comes from the way line editing was done on Unix.
For example, âedâ uses the following syntax to print a list of
@@ -1312,8 +1451,25 @@
global/regular expression/print
g/re/p
- âfgrepâ stands for Fixed âgrepâ; âegrepâ stands for Extended
- âgrepâ.
+ The â-Eâ option stands for Extended âgrepâ. The â-Fâ option
stands
+ for Fixed âgrepâ;
+
+ 17. What happened to âegrepâ and âfgrepâ?
+
+ 7th Edition Unix had commands âegrepâ and âfgrepâ that were the
+ counterparts of the modern âgrep -Eâ and âgrep -Fâ. Although
+ breaking up âgrepâ into three programs was perhaps useful on the
+ small computers of the 1970s, âegrepâ and âfgrepâ were not
+ standardized by POSIX and are no longer needed. In the current GNU
+ implementation, âegrepâ and âfgrepâ issue a warning and then act
+ like their modern counterparts; eventually, they are planned to be
+ removed entirely.
+
+ If you prefer the old names, you can use use your own substitutes,
+ such as a shell script named âegrepâ with the following contents:
+
+ #!/bin/sh
+ exec grep -E "$@"
5 Performance
*************
@@ -1344,6 +1500,15 @@
inefficient due to difficulties in fast portable access to concepts like
multi-character collating elements.
+ Interval expressions may be implemented internally via repetition.
+For example, â^(a|bc){2,4}$â might be implemented as
+â^(a|bc)(a|bc)((a|bc)(a|bc)?)?$â. A large repetition count may exhaust
+memory or greatly slow matching. Even small counts can cause problems
+if cascaded; for example, âgrep -E ".*{10,}{10,}{10,}{10,}{10,}"â is
+likely to overflow a stack. Fortunately, regular expressions like these
+are typically artificial, and cascaded repetitions do not conform to
+POSIX so cannot be used in portable programs anyway.
+
A back-reference such as â\1â can hurt performance significantly in
some cases, since back-references cannot in general be implemented via a
finite state automaton, and instead trigger a backtracking algorithm
@@ -1361,6 +1526,13 @@
is used (*note File and Directory Selection::), unless the â-zâ
(â--null-dataâ) option is also used (*note Other Options::).
+ For efficiency âgrepâ does not always read all its input. For
+example, the shell command âsed '/^...$/d' | grep -q Xâ can cause
âgrepâ
+to exit immediately after reading a line containing âXâ, without
+bothering to read the rest of its input data. This in turn can cause
+âsedâ to exit with a nonzero status because âsedâ cannot write to its
+output pipe after âgrepâ exits.
+
For more about the algorithms used by âgrepâ and about related string
matching algorithms, see:
@@ -1371,19 +1543,31 @@
⢠Aho AV, Corasick MJ. Efficient string matching: an aid to
bibliographic search. _CACM_. 1975;18(6):333â40.
- <https://dx.doi.org/10.1145/360825.360855>. This introduces the
+ <https://doi.org/10.1145/360825.360855>. This introduces the
AhoâCorasick algorithm.
⢠Boyer RS, Moore JS. A fast string searching algorithm. _CACM_.
- 1977;20(10):762â72. <https://dx.doi.org/10.1145/359842.359859>.
- This introduces the BoyerâMoore algorithm.
+ 1977;20(10):762â72. <https://doi.org/10.1145/359842.359859>. This
+ introduces the BoyerâMoore algorithm.
⢠Faro S, Lecroq T. The exact online string matching problem: a
review of the most recent results. _ACM Comput Surv_.
- 2013;45(2):13. <https://dx.doi.org/10.1145/2431211.2431212>. This
+ 2013;45(2):13. <https://doi.org/10.1145/2431211.2431212>. This
surveys string matching algorithms that might help improve the
performance of âgrepâ in the future.
+ ⢠Hakak SI, Kamsin A, Shivakumara P, Gilkar GA, Khan WZ, Imran M.
+ Exact string matching algorithms: survey issues, and future
+ research directions. _IEEE Access_. 2019;7:69614â37.
+ <https://doi.org/10.1109/ACCESS.2019.2914071>. This survey is more
+ recent than Faro & Lecroq, and focuses on taxonomy instead of
+ performance.
+
+ ⢠Hume A, Sunday D. Fast string search. _Software Pract Exper_.
+ 1991;21(11):1221â48. <https://doi.org/10.1002/spe.4380211105>. This
+ excellent albeit now-dated survey aided the initial development of
+ âgrepâ.
+
6 Reporting bugs
****************
@@ -1920,482 +2104,491 @@
* Menu:
* *: Fundamental Structure.
- (line 817)
+ (line 811)
* +: Fundamental Structure.
- (line 820)
-* --: Other Options. (line 497)
+ (line 814)
+* --: Other Options. (line 498)
* --after-context: Context Line Control.
- (line 339)
+ (line 340)
* --basic-regexp: grep Programs. (line 754)
* --before-context: Context Line Control.
- (line 343)
-* --binary: Other Options. (line 512)
+ (line 344)
+* --binary: Other Options. (line 513)
* --binary-files: File and Directory Selection.
- (line 389)
+ (line 390)
* --byte-offset: Output Line Prefix Control.
- (line 280)
+ (line 281)
* --color: General Output Control.
- (line 187)
+ (line 188)
* --colour: General Output Control.
- (line 187)
+ (line 188)
* --context: Context Line Control.
- (line 348)
+ (line 349)
* --count: General Output Control.
- (line 181)
+ (line 182)
* --dereference-recursive: File and Directory Selection.
- (line 490)
+ (line 491)
* --devices: File and Directory Selection.
- (line 428)
+ (line 429)
* --directories: File and Directory Selection.
- (line 439)
+ (line 440)
* --exclude: File and Directory Selection.
- (line 450)
+ (line 451)
* --exclude-dir: File and Directory Selection.
- (line 464)
+ (line 465)
* --exclude-from: File and Directory Selection.
- (line 460)
+ (line 461)
* --extended-regexp: grep Programs. (line 759)
-* --file: Matching Control. (line 115)
+* --file: Matching Control. (line 116)
* --files-with-matches: General Output Control.
- (line 207)
+ (line 212)
* --files-without-match: General Output Control.
- (line 202)
+ (line 207)
* --fixed-strings: grep Programs. (line 764)
* --group-separator: Context Line Control.
- (line 351)
+ (line 352)
* --group-separator <1>: Context Line Control.
- (line 355)
+ (line 356)
* --help: Generic Program Information.
- (line 93)
-* --ignore-case: Matching Control. (line 124)
+ (line 94)
+* --ignore-case: Matching Control. (line 125)
* --include: File and Directory Selection.
- (line 474)
+ (line 475)
* --initial-tab: Output Line Prefix Control.
- (line 309)
-* --invert-match: Matching Control. (line 149)
+ (line 310)
+* --invert-match: Matching Control. (line 150)
* --label: Output Line Prefix Control.
- (line 296)
-* --line-buffered: Other Options. (line 503)
+ (line 297)
+* --line-buffered: Other Options. (line 504)
* --line-number: Output Line Prefix Control.
- (line 304)
-* --line-regexp: Matching Control. (line 171)
+ (line 305)
+* --line-regexp: Matching Control. (line 172)
* --max-count: General Output Control.
- (line 213)
+ (line 218)
* --no-filename: Output Line Prefix Control.
- (line 291)
-* --no-ignore-case: Matching Control. (line 142)
+ (line 292)
+* --no-ignore-case: Matching Control. (line 143)
* --no-messages: General Output Control.
- (line 258)
+ (line 269)
* --null: Output Line Prefix Control.
- (line 318)
-* --null-data: Other Options. (line 533)
+ (line 319)
+* --null-data: Other Options. (line 534)
* --only-matching: General Output Control.
- (line 243)
+ (line 252)
* --perl-regexp: grep Programs. (line 769)
* --quiet: General Output Control.
- (line 251)
+ (line 260)
* --recursive: File and Directory Selection.
- (line 482)
-* --regexp=PATTERNS: Matching Control. (line 106)
+ (line 483)
+* --regexp=PATTERNS: Matching Control. (line 107)
* --silent: General Output Control.
- (line 251)
+ (line 260)
* --text: File and Directory Selection.
- (line 385)
+ (line 386)
* --version: Generic Program Information.
- (line 98)
+ (line 99)
* --with-filename: Output Line Prefix Control.
- (line 286)
-* --word-regexp: Matching Control. (line 154)
+ (line 287)
+* --word-regexp: Matching Control. (line 155)
* -A: Context Line Control.
- (line 339)
+ (line 340)
* -a: File and Directory Selection.
- (line 385)
+ (line 386)
* -b: Output Line Prefix Control.
- (line 280)
+ (line 281)
* -B: Context Line Control.
- (line 343)
+ (line 344)
* -c: General Output Control.
- (line 181)
+ (line 182)
* -C: Context Line Control.
- (line 348)
+ (line 349)
* -D: File and Directory Selection.
- (line 428)
+ (line 429)
* -d: File and Directory Selection.
- (line 439)
-* -e: Matching Control. (line 106)
+ (line 440)
+* -e: Matching Control. (line 107)
* -E: grep Programs. (line 759)
-* -f: Matching Control. (line 115)
+* -f: Matching Control. (line 116)
* -F: grep Programs. (line 764)
* -G: grep Programs. (line 754)
* -H: Output Line Prefix Control.
- (line 286)
+ (line 287)
* -h: Output Line Prefix Control.
- (line 291)
-* -i: Matching Control. (line 124)
+ (line 292)
+* -i: Matching Control. (line 125)
* -L: General Output Control.
- (line 202)
-* -l: General Output Control.
(line 207)
+* -l: General Output Control.
+ (line 212)
* -m: General Output Control.
- (line 213)
+ (line 218)
* -n: Output Line Prefix Control.
- (line 304)
+ (line 305)
* -NUM: Context Line Control.
- (line 348)
+ (line 349)
* -o: General Output Control.
- (line 243)
+ (line 252)
* -P: grep Programs. (line 769)
* -q: General Output Control.
- (line 251)
+ (line 260)
* -r: File and Directory Selection.
- (line 482)
+ (line 483)
* -R: File and Directory Selection.
- (line 490)
+ (line 491)
* -s: General Output Control.
- (line 258)
+ (line 269)
* -T: Output Line Prefix Control.
- (line 309)
-* -U: Other Options. (line 512)
+ (line 310)
+* -U: Other Options. (line 513)
* -V: Generic Program Information.
- (line 98)
-* -v: Matching Control. (line 149)
-* -w: Matching Control. (line 154)
-* -x: Matching Control. (line 171)
-* -y: Matching Control. (line 124)
+ (line 99)
+* -v: Matching Control. (line 150)
+* -w: Matching Control. (line 155)
+* -x: Matching Control. (line 172)
+* -y: Matching Control. (line 125)
* -Z: Output Line Prefix Control.
- (line 318)
-* -z: Other Options. (line 533)
+ (line 319)
+* -z: Other Options. (line 534)
* .: Fundamental Structure.
- (line 806)
+ (line 800)
* ?: Fundamental Structure.
- (line 814)
+ (line 808)
* _N_GNU_nonoption_argv_flags_ environment variable: Environment Variables.
(line 713)
* {,M}: Fundamental Structure.
- (line 829)
+ (line 823)
* {N,M}: Fundamental Structure.
- (line 833)
+ (line 827)
* {N,}: Fundamental Structure.
- (line 826)
+ (line 820)
* {N}: Fundamental Structure.
- (line 823)
+ (line 817)
* after context: Context Line Control.
- (line 339)
+ (line 340)
* alnum character class: Character Classes and Bracket
Expressions.
- (line 878)
+ (line 876)
* alpha character class: Character Classes and Bracket
Expressions.
- (line 883)
+ (line 881)
* alphabetic characters: Character Classes and Bracket
Expressions.
- (line 883)
+ (line 881)
* alphanumeric characters: Character Classes and Bracket
Expressions.
- (line 878)
-* anchoring: Anchoring. (line 1007)
+ (line 876)
+* alternatives in regular expressions: Fundamental Structure.
+ (line 835)
+* anchoring: Anchoring. (line 1017)
* asterisk: Fundamental Structure.
- (line 817)
+ (line 811)
* back-reference: Back-references and Subexpressions.
- (line 1015)
-* back-references: Performance. (line 1346)
-* backslash: The Backslash Character and Special
Expressions.
- (line 973)
-* basic regular expressions: Basic vs Extended. (line 1031)
+ (line 1025)
+* back-references: Performance. (line 1511)
+* backslash: Special Backslash Expressions.
+ (line 971)
+* basic regular expressions: Basic vs Extended. (line 1041)
* before context: Context Line Control.
- (line 343)
+ (line 344)
* binary files: File and Directory Selection.
- (line 385)
+ (line 386)
* binary files <1>: File and Directory Selection.
- (line 389)
-* binary I/O: Other Options. (line 512)
+ (line 390)
+* binary I/O: Other Options. (line 513)
* blank character class: Character Classes and Bracket
Expressions.
- (line 888)
+ (line 886)
* blank characters: Character Classes and Bracket
Expressions.
- (line 888)
+ (line 886)
* bn GREP_COLORS capability: Environment Variables.
- (line 656)
+ (line 654)
* braces, first argument omitted: Fundamental Structure.
- (line 829)
-* braces, one argument: Fundamental Structure.
(line 823)
+* braces, one argument: Fundamental Structure.
+ (line 817)
* braces, second argument omitted: Fundamental Structure.
- (line 826)
+ (line 820)
* braces, two arguments: Fundamental Structure.
- (line 833)
+ (line 827)
* bracket expression: Character Classes and Bracket
Expressions.
- (line 853)
-* Bugs, known: Known Bugs. (line 1397)
-* bugs, reporting: Reporting Bugs. (line 1389)
+ (line 850)
+* Bugs, known: Known Bugs. (line 1581)
+* bugs, reporting: Reporting Bugs. (line 1573)
* byte offset: Output Line Prefix Control.
- (line 280)
-* case insensitive search: Matching Control. (line 124)
-* case insensitive search <1>: Performance. (line 1341)
+ (line 281)
+* case insensitive search: Matching Control. (line 125)
+* case insensitive search <1>: Performance. (line 1497)
* changing name of standard input: Output Line Prefix Control.
- (line 296)
+ (line 297)
* character class: Character Classes and Bracket
Expressions.
- (line 853)
+ (line 850)
* character classes: Character Classes and Bracket
Expressions.
- (line 877)
-* character encoding: Character Encoding. (line 1067)
+ (line 875)
+* character encoding: Character Encoding. (line 1179)
* character type: Environment Variables.
- (line 683)
+ (line 681)
* classes of characters: Character Classes and Bracket
Expressions.
- (line 877)
+ (line 875)
* cntrl character class: Character Classes and Bracket
Expressions.
- (line 891)
+ (line 889)
* context lines: General Output Control.
- (line 235)
+ (line 244)
* context lines <1>: Context Line Control.
- (line 330)
+ (line 331)
* context lines <2>: Context Line Control.
- (line 348)
+ (line 349)
* context lines, after match: Context Line Control.
- (line 339)
+ (line 340)
* context lines, before match: Context Line Control.
- (line 343)
+ (line 344)
* control characters: Character Classes and Bracket
Expressions.
- (line 891)
-* copying: Copying. (line 1417)
+ (line 889)
+* copying: Copying. (line 1601)
* counting lines: General Output Control.
- (line 181)
+ (line 182)
* cx GREP_COLORS capability: Environment Variables.
- (line 607)
+ (line 605)
* device search: File and Directory Selection.
- (line 428)
+ (line 429)
* digit character class: Character Classes and Bracket
Expressions.
- (line 896)
+ (line 894)
* digit characters: Character Classes and Bracket
Expressions.
- (line 896)
+ (line 894)
* directory search: File and Directory Selection.
- (line 439)
+ (line 440)
* dot: Fundamental Structure.
- (line 806)
+ (line 800)
* encoding error: Environment Variables.
- (line 690)
+ (line 688)
* environment variables: Environment Variables.
- (line 579)
+ (line 560)
* exclude directories: File and Directory Selection.
- (line 464)
+ (line 465)
* exclude files: File and Directory Selection.
- (line 450)
+ (line 451)
* exclude files <1>: File and Directory Selection.
- (line 460)
+ (line 461)
* exit status: Exit Status. (line 736)
-* FAQ about grep usage: Usage. (line 1151)
+* FAQ about grep usage: Usage. (line 1263)
* files which donât match: General Output Control.
- (line 202)
+ (line 207)
* fn GREP_COLORS capability: Environment Variables.
- (line 646)
+ (line 644)
* fn GREP_COLORS capability <1>: Environment Variables.
- (line 661)
+ (line 659)
* graph character class: Character Classes and Bracket
Expressions.
- (line 899)
+ (line 897)
* graphic characters: Character Classes and Bracket
Expressions.
- (line 899)
+ (line 897)
* grep programs: grep Programs. (line 745)
* GREP_COLOR environment variable: Environment Variables.
- (line 580)
+ (line 563)
* GREP_COLORS environment variable: Environment Variables.
- (line 591)
+ (line 569)
* group separator: Context Line Control.
- (line 351)
+ (line 352)
* group separator <1>: Context Line Control.
- (line 355)
+ (line 356)
* hexadecimal digits: Character Classes and Bracket
Expressions.
- (line 923)
+ (line 921)
* highlight markers: Environment Variables.
- (line 580)
+ (line 563)
* highlight markers <1>: Environment Variables.
- (line 591)
+ (line 569)
* highlight, color, colour: General Output Control.
- (line 187)
-* holes in files: Performance. (line 1356)
+ (line 188)
+* holes in files: Performance. (line 1521)
* include files: File and Directory Selection.
- (line 474)
+ (line 475)
* interval expressions: Fundamental Structure.
- (line 809)
-* interval expressions <1>: Basic vs Extended. (line 1052)
-* invert matching: Matching Control. (line 149)
+ (line 803)
+* interval expressions <1>: Performance. (line 1502)
+* invalid regular expressions: Problematic Expressions.
+ (line 1066)
+* invert matching: Matching Control. (line 150)
* LANG environment variable: Environment Variables.
- (line 544)
+ (line 546)
* LANG environment variable <1>: Environment Variables.
- (line 683)
+ (line 681)
* LANG environment variable <2>: Environment Variables.
- (line 690)
+ (line 688)
* LANG environment variable <3>: Environment Variables.
- (line 699)
+ (line 697)
* LANGUAGE environment variable: Environment Variables.
- (line 544)
+ (line 546)
* LANGUAGE environment variable <1>: Environment Variables.
- (line 699)
+ (line 697)
* language of messages: Environment Variables.
- (line 699)
+ (line 697)
* LC_ALL environment variable: Environment Variables.
- (line 544)
+ (line 546)
* LC_ALL environment variable <1>: Environment Variables.
- (line 683)
+ (line 681)
* LC_ALL environment variable <2>: Environment Variables.
- (line 690)
+ (line 688)
* LC_ALL environment variable <3>: Environment Variables.
- (line 699)
+ (line 697)
* LC_COLLATE environment variable: Environment Variables.
- (line 683)
+ (line 681)
* LC_CTYPE environment variable: Environment Variables.
- (line 690)
+ (line 688)
* LC_MESSAGES environment variable: Environment Variables.
- (line 544)
+ (line 546)
* LC_MESSAGES environment variable <1>: Environment Variables.
- (line 699)
-* line buffering: Other Options. (line 503)
+ (line 697)
+* line buffering: Other Options. (line 504)
* line numbering: Output Line Prefix Control.
- (line 304)
+ (line 305)
* ln GREP_COLORS capability: Environment Variables.
- (line 651)
-* locales: Performance. (line 1334)
+ (line 649)
+* locales: Performance. (line 1490)
* lower character class: Character Classes and Bracket
Expressions.
- (line 902)
+ (line 900)
* lower-case letters: Character Classes and Bracket
Expressions.
- (line 902)
+ (line 900)
* match expression at most M times: Fundamental Structure.
- (line 829)
+ (line 823)
* match expression at most once: Fundamental Structure.
- (line 814)
+ (line 808)
* match expression from N to M times: Fundamental Structure.
- (line 833)
+ (line 827)
* match expression N or more times: Fundamental Structure.
- (line 826)
+ (line 820)
* match expression N times: Fundamental Structure.
- (line 823)
+ (line 817)
* match expression one or more times: Fundamental Structure.
- (line 820)
+ (line 814)
* match expression zero or more times: Fundamental Structure.
- (line 817)
-* match the whole line: Matching Control. (line 171)
+ (line 811)
+* match the whole line: Matching Control. (line 172)
* matching basic regular expressions: grep Programs. (line 754)
* matching extended regular expressions: grep Programs. (line 759)
* matching fixed strings: grep Programs. (line 764)
* matching Perl-compatible regular expressions: grep Programs.
(line 769)
-* matching whole words: Matching Control. (line 154)
+* matching whole words: Matching Control. (line 155)
* max-count: General Output Control.
- (line 213)
+ (line 218)
* mc GREP_COLORS capability: Environment Variables.
- (line 638)
+ (line 636)
* message language: Environment Variables.
- (line 699)
+ (line 697)
* ms GREP_COLORS capability: Environment Variables.
- (line 630)
-* MS-Windows binary I/O: Other Options. (line 512)
+ (line 628)
+* MS-Windows binary I/O: Other Options. (line 513)
* mt GREP_COLORS capability: Environment Variables.
- (line 622)
+ (line 620)
* names of matching files: General Output Control.
- (line 207)
+ (line 212)
* national language support: Environment Variables.
- (line 683)
+ (line 681)
* national language support <1>: Environment Variables.
- (line 699)
+ (line 697)
* ne GREP_COLORS capability: Environment Variables.
- (line 668)
+ (line 666)
* NLS: Environment Variables.
- (line 683)
+ (line 681)
* no filename prefix: Output Line Prefix Control.
- (line 291)
-* non-ASCII matching: Matching Non-ASCII. (line 1092)
-* non-printable matching: Matching Non-ASCII. (line 1092)
+ (line 292)
+* non-ASCII matching: Matching Non-ASCII. (line 1204)
+* non-printable matching: Matching Non-ASCII. (line 1204)
* null character: Environment Variables.
- (line 690)
+ (line 688)
* numeric characters: Character Classes and Bracket
Expressions.
- (line 896)
+ (line 894)
* only matching: General Output Control.
- (line 243)
-* option delimiter: Other Options. (line 497)
+ (line 252)
+* option delimiter: Other Options. (line 498)
* ordinary characters: Fundamental Structure.
- (line 801)
-* patterns from file: Matching Control. (line 115)
-* patterns option: Matching Control. (line 106)
-* performance: Performance. (line 1320)
+ (line 795)
+* patterns from file: Matching Control. (line 116)
+* patterns option: Matching Control. (line 107)
+* performance: Performance. (line 1476)
* period: Fundamental Structure.
- (line 806)
+ (line 800)
+* pipelines and reading: Performance. (line 1528)
* plus sign: Fundamental Structure.
- (line 820)
+ (line 814)
* POSIXLY_CORRECT environment variable: Environment Variables.
- (line 704)
+ (line 702)
* print character class: Character Classes and Bracket
Expressions.
- (line 906)
-* print non-matching lines: Matching Control. (line 149)
+ (line 904)
+* print non-matching lines: Matching Control. (line 150)
* printable characters: Character Classes and Bracket
Expressions.
- (line 906)
+ (line 904)
* punct character class: Character Classes and Bracket
Expressions.
- (line 909)
+ (line 907)
* punctuation characters: Character Classes and Bracket
Expressions.
- (line 909)
+ (line 907)
* question mark: Fundamental Structure.
- (line 814)
+ (line 808)
* quiet, silent: General Output Control.
- (line 251)
+ (line 260)
* range expression: Character Classes and Bracket
Expressions.
- (line 861)
+ (line 858)
* recursive search: File and Directory Selection.
- (line 482)
+ (line 483)
* recursive search <1>: File and Directory Selection.
- (line 490)
+ (line 491)
* regular expressions: Regular Expressions.
- (line 784)
+ (line 778)
* return status: Exit Status. (line 736)
* rv GREP_COLORS capability: Environment Variables.
- (line 616)
+ (line 614)
* searching directory trees: File and Directory Selection.
- (line 450)
+ (line 451)
* searching directory trees <1>: File and Directory Selection.
- (line 460)
+ (line 461)
* searching directory trees <2>: File and Directory Selection.
- (line 474)
+ (line 475)
* searching directory trees <3>: File and Directory Selection.
- (line 482)
+ (line 483)
* searching directory trees <4>: File and Directory Selection.
- (line 490)
-* searching for patterns: Introduction. (line 51)
+ (line 491)
+* searching for patterns: Introduction. (line 52)
* sl GREP_COLORS capability: Environment Variables.
- (line 599)
+ (line 597)
* space character class: Character Classes and Bracket
Expressions.
- (line 914)
+ (line 912)
* space characters: Character Classes and Bracket
Expressions.
- (line 914)
+ (line 912)
* special characters: Fundamental Structure.
- (line 801)
+ (line 795)
* subexpression: Back-references and Subexpressions.
- (line 1015)
+ (line 1025)
* suppress binary data: File and Directory Selection.
- (line 385)
+ (line 386)
* suppress error messages: General Output Control.
- (line 258)
+ (line 269)
* symbolic links: File and Directory Selection.
- (line 439)
+ (line 440)
* symbolic links <1>: File and Directory Selection.
- (line 482)
+ (line 483)
* symbolic links <2>: File and Directory Selection.
- (line 490)
+ (line 491)
* tab-aligned content lines: Output Line Prefix Control.
- (line 309)
+ (line 310)
+* TERM environment variable: Environment Variables.
+ (line 709)
* translation of message language: Environment Variables.
- (line 699)
+ (line 697)
+* unspecified behavior in regular expressions: Problematic Expressions.
+ (line 1066)
* upper character class: Character Classes and Bracket
Expressions.
- (line 919)
+ (line 917)
* upper-case letters: Character Classes and Bracket
Expressions.
- (line 919)
+ (line 917)
* usage summary, printing: Generic Program Information.
- (line 93)
-* usage, examples: Usage. (line 1125)
-* using grep, Q&A: Usage. (line 1151)
+ (line 94)
+* usage, examples: Usage. (line 1237)
+* using grep, Q&A: Usage. (line 1263)
* variants of grep: grep Programs. (line 745)
* version, printing: Generic Program Information.
- (line 98)
+ (line 99)
* whitespace characters: Character Classes and Bracket
Expressions.
- (line 914)
+ (line 912)
* with filename prefix: Output Line Prefix Control.
- (line 286)
+ (line 287)
* xdigit character class: Character Classes and Bracket
Expressions.
- (line 923)
+ (line 921)
* xdigit class: Character Classes and Bracket
Expressions.
- (line 923)
+ (line 921)
* zero-terminated file names: Output Line Prefix Control.
- (line 318)
-* zero-terminated lines: Other Options. (line 533)
+ (line 319)
+* zero-terminated lines: Other Options. (line 534)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to grep/manual/grep.txt,v,
Jim Meyering <=