diff options
author | Charles Levert <charles_levert@gna.org> | 2005-08-24 07:28:29 +0000 |
---|---|---|
committer | Charles Levert <charles_levert@gna.org> | 2005-08-24 07:28:29 +0000 |
commit | 268c542052401bc3f3b9d2e006a254da5e3bac28 (patch) | |
tree | 7e9fca0823db1e6dc6096d8e131bbcde1500d068 /doc | |
parent | 7727478edf630a64b963b5c54936f9845f52dd72 (diff) | |
download | grep-268c542052401bc3f3b9d2e006a254da5e3bac28.tar.gz |
* src/grep.c (print_line_middle): In case of an empty match,
make minimal progress and continue instead of aborting process
of the remainder of the line, in case there's still an upcoming
non-empty match.
* tests/foad1.sh: Add two tests for this.
* doc/grep.texi, doc/grep.1: Document this behavior, since
--only-matching and --color are GNU extensions which are
otherwise unspecified by POSIX or other standards.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/grep.1 | 17 | ||||
-rw-r--r-- | doc/grep.texi | 15 |
2 files changed, 17 insertions, 15 deletions
@@ -12,7 +12,7 @@ .de Id .ds Dt \\$4 .. -.Id $Id: grep.1,v 1.32 2005/07/05 01:03:33 charles_levert Exp $ +.Id $Id: grep.1,v 1.33 2005/08/24 07:28:29 charles_levert Exp $ .TH GREP 1 \*(Dt "GNU Project" .SH NAME grep, egrep, fgrep \- print lines matching a pattern @@ -127,8 +127,8 @@ which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands. .TP .BI \-\^\-color[=\fIWHEN\fR] ", " \-\^\-colour[=\fIWHEN\fR] -Surround the matching strings, matching lines, context lines, file -names, line numbers, octet offsets, and separators (for fields and +Surround the matching non-empty strings, matching lines, context lines, +file names, line numbers, octet 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 @@ -314,7 +314,7 @@ Prefix each line of output with the line number within its input file. .TP .BR \-o ", " \-\^\-only-matching -Show only the part of a matching line that matches +Show only the non-empty parts of a matching line that match .IR PATTERN . .TP .BR \-P ", " \-\^\-perl-regexp @@ -724,13 +724,14 @@ so it can be used to specify an option containing whitespace or a backslash. Deprecated in favor of .BR GREP_COLORS , which has priority. -It can only specify the marker for highlighting matched text and +It can only specify the marker for highlighting matched non-empty text and defaults to `01;31' (bold red). .TP .B GREP_COLORS -Specifies the markers for highlighting matched text (mt), matching lines -(ml), context lines (cx), file names (fn), line numbers (ln), octet -offsets (bn), and separators (se, for fields and groups of context lines). +Specifies the markers for highlighting matched non-empty text (mt), +matching lines (ml), context lines (cx), file names (fn), line numbers +(ln), octet offsets (bn), and separators (se, for fields and groups of +context lines). It is a colon-separated list of color specification assignments. The default is `mt=01;31:ml=:cx=:fn=35:ln=32:bn=32:se=36' which means bold red, default, default, magenta, green, green, and cyan, all text diff --git a/doc/grep.texi b/doc/grep.texi index 3d805614..dd751f38 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -190,7 +190,8 @@ Prefix each line of output with the line number within its input file. @opindex -o @opindex --only-matching @cindex only matching -Print only the part of matching lines that actually matches @var{pattern}. +Print only the non-empty parts of matching lines +that actually match @var{pattern}. @item -q @itemx --quiet @@ -267,10 +268,10 @@ Print @var{num} lines of output context. @opindex --color @opindex --colour @cindex highlight, color, colour -Surround the matching strings, matching lines, context lines, file names, -line numbers, octet offsets, and separators (for fields and groups -of context lines) with escape sequences to display them in color on -the terminal. +Surround the matching non-empty strings, matching lines, context lines, +file names, line numbers, octet 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} and default to `mt=01;31:ml=:cx=:fn=35:ln=32:bn=32:se=36' for bold red matched text, magenta file names, green line numbers, green octet offsets, @@ -603,7 +604,7 @@ specify an option containing whitespace or a backslash. @cindex highlight markers This variable is deprecated but still supported; its setting does not have priority over that of @code{GREP_COLORS}. -It specifies the color used to highlight the matching text. +It specifies the color used to highlight the matching non-empty text. The default is `01;31' which means bold red text on the default background. @@ -611,7 +612,7 @@ background. @vindex GREP_COLORS @cindex highlight markers This variable specifies the colors used to highlight -the matching text (mt), matching lines (ml), context lines (cx), +the matching non-empty text (mt), matching lines (ml), context lines (cx), file names (fn), line numbers (ln), octet offsets (bn), and separators (se, for fields and groups of context lines). It is a colon-separated list of color specification assignments. |