CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 16/02/05 00:44:53
Index: html_node/Context-Line-Control.html =================================================================== RCS file: /webcvs/grep/grep/manual/html_node/Context-Line-Control.html,v retrieving revision 1.21 retrieving revision 1.22 diff -u -b -r1.21 -r1.22 --- html_node/Context-Line-Control.html 2 Nov 2015 02:54:32 -0000 1.21 +++ html_node/Context-Line-Control.html 5 Feb 2016 00:44:51 -0000 1.22 @@ -1,99 +1,159 @@ -<html lang="en"> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This manual is for grep, a pattern matching engine. + +Copyright (C) 1999-2002, 2005, 2008-2016 Free Software Foundation, +Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the section entitled +"GNU Free Documentation License". --> +<!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ --> <head> -<title>Context Line Control - GNU Grep 2.22</title> +<title>GNU Grep 2.23: Context Line Control</title> + +<meta name="description" content="GNU Grep 2.23: Context Line Control"> +<meta name="keywords" content="GNU Grep 2.23: Context Line Control"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<meta name="description" content="GNU Grep 2.22"> -<meta name="generator" content="makeinfo 4.13"> -<link title="Top" rel="start" href="index.html#Top"> -<link rel="up" href="Command_002dline-Options.html#Command_002dline-Options" title="Command-line Options"> -<link rel="prev" href="Output-Line-Prefix-Control.html#Output-Line-Prefix-Control" title="Output Line Prefix Control"> -<link rel="next" href="File-and-Directory-Selection.html#File-and-Directory-Selection" title="File and Directory Selection"> -<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Index.html#Index" rel="index" title="Index"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="Command_002dline-Options.html#Command_002dline-Options" rel="up" title="Command-line Options"> +<link href="File-and-Directory-Selection.html#File-and-Directory-Selection" rel="next" title="File and Directory Selection"> +<link href="Output-Line-Prefix-Control.html#Output-Line-Prefix-Control" rel="prev" title="Output Line Prefix Control"> +<style type="text/css"> <!-- -This manual is for `grep', a pattern matching engine. +a.summary-letter {text-decoration: none} +blockquote.indentedblock {margin-right: 0em} +blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smalllisp {margin-left: 3.2em} +kbd {font-style: oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space: nowrap} +span.nolinebreak {white-space: nowrap} +span.roman {font-family: serif; font-weight: normal} +span.sansserif {font-family: sans-serif; font-weight: normal} +ul.no-bullet {list-style: none} +--> +</style> +<link rel="stylesheet" type="text/css" href="/software/gnulib/manual.css"> -Copyright (C) 1999-2002, 2005, 2008-2015 Free Software Foundation, -Inc. - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, with no Front-Cover Texts, - and with no Back-Cover Texts. A copy of the license is included - in the section entitled ``GNU Free Documentation License''. - --> -<meta http-equiv="Content-Style-Type" content="text/css"> -<style type="text/css"><!-- - pre.display { font-family:inherit } - pre.format { font-family:inherit } - pre.smalldisplay { font-family:inherit; font-size:smaller } - pre.smallformat { font-family:inherit; font-size:smaller } - pre.smallexample { font-size:smaller } - pre.smalllisp { font-size:smaller } - span.sc { font-variant:small-caps } - span.roman { font-family:serif; font-weight:normal; } - span.sansserif { font-family:sans-serif; font-weight:normal; } ---></style> -<link rel="stylesheet" type="text/css" href="/software/gnulib/manual.css"> </head> -<body> -<div class="node"> + +<body lang="en"> <a name="Context-Line-Control"></a> +<div class="header"> <p> -Next: <a rel="next" accesskey="n" href="File-and-Directory-Selection.html#File-and-Directory-Selection">File and Directory Selection</a>, -Previous: <a rel="previous" accesskey="p" href="Output-Line-Prefix-Control.html#Output-Line-Prefix-Control">Output Line Prefix Control</a>, -Up: <a rel="up" accesskey="u" href="Command_002dline-Options.html#Command_002dline-Options">Command-line Options</a> -<hr> +Next: <a href="File-and-Directory-Selection.html#File-and-Directory-Selection" accesskey="n" rel="next">File and Directory Selection</a>, Previous: <a href="Output-Line-Prefix-Control.html#Output-Line-Prefix-Control" accesskey="p" rel="prev">Output Line Prefix Control</a>, Up: <a href="Command_002dline-Options.html#Command_002dline-Options" accesskey="u" rel="up">Command-line Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> </div> - +<hr> +<a name="Context-Line-Control-1"></a> <h4 class="subsection">2.1.5 Context Line Control</h4> <p>Regardless of how these options are set, -<samp><span class="command">grep</span></samp> will never print any given line more than once. -If the <samp><span class="option">-o</span></samp> (<samp><span class="option">--only-matching</span></samp>) option is specified, +<code>grep</code> will never print any given line more than once. +If the <samp>-o</samp> (<samp>--only-matching</samp>) option is specified, these options have no effect and a warning is given upon their use. - - <dl> -<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="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="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="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> between groups of lines. - - <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, +</p> +<dl compact="compact"> +<dt><samp>-A <var>num</var></samp></dt> +<dt><samp>--after-context=<var>num</var></samp></dt> +<dd><a name="index-_002dA"></a> +<a name="index-_002d_002dafter_002dcontext"></a> +<a name="index-after-context"></a> +<a name="index-context-lines_002c-after-match"></a> +<p>Print <var>num</var> lines of trailing context after matching lines. +</p> +</dd> +<dt><samp>-B <var>num</var></samp></dt> +<dt><samp>--before-context=<var>num</var></samp></dt> +<dd><a name="index-_002dB"></a> +<a name="index-_002d_002dbefore_002dcontext"></a> +<a name="index-before-context"></a> +<a name="index-context-lines_002c-before-match"></a> +<p>Print <var>num</var> lines of leading context before matching lines. +</p> +</dd> +<dt><samp>-C <var>num</var></samp></dt> +<dt><samp>-<var>num</var></samp></dt> +<dt><samp>--context=<var>num</var></samp></dt> +<dd><a name="index-_002dC"></a> +<a name="index-_002d_002dcontext"></a> +<a name="index-_002dnum"></a> +<a name="index-context"></a> +<p>Print <var>num</var> lines of leading and trailing output context. +</p> +</dd> +<dt><samp>--group-separator=<var>string</var></samp></dt> +<dd><a name="index-_002d_002dgroup_002dseparator"></a> +<a name="index-group-separator"></a> +<p>When <samp>-A</samp>, <samp>-B</samp> or <samp>-C</samp> are in use, +print <var>string</var> instead of <samp>--</samp> between groups of lines. +</p> +</dd> +<dt><samp>--no-group-separator</samp></dt> +<dd><a name="index-_002d_002dgroup_002dseparator-1"></a> +<a name="index-group-separator-1"></a> +<p>When <samp>-A</samp>, <samp>-B</samp> or <samp>-C</samp> are in use, do not print a separator between groups of lines. +</p> +</dd> +</dl> - </dl> - - <p>Here are some points about how <samp><span class="command">grep</span></samp> chooses +<p>Here are some points about how <code>grep</code> 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 +</p> +<ul> +<li> Matching lines normally use ‘<samp>:</samp>’ as a separator between prefix fields and actual line content. - <li>Context (i.e., non-matching) lines use ‘<samp><span class="samp">-</span></samp>’ instead. +</li><li> Context (i.e., non-matching) lines use ‘<samp>-</samp>’ instead. - <li>When context is not specified, +</li><li> When context is not specified, matching lines are simply output one right after another. - <li>When context is specified, +</li><li> When context is specified, lines that are adjacent in the input form a group and are output one right after another, while by default a separator appears between non-adjacent groups. - <li>The default separator -is a ‘<samp><span class="samp">--</span></samp>’ line; its presence and appearance +</li><li> The default separator +is a ‘<samp>--</samp>’ line; its presence and appearance can be changed with the options above. - <li>Each group may contain +</li><li> Each group may contain several matching lines when they are close enough to each other that two adjacent groups connect and can merge into a single contiguous one. -</ul> +</li></ul> + +<hr> +<div class="header"> +<p> +Next: <a href="File-and-Directory-Selection.html#File-and-Directory-Selection" accesskey="n" rel="next">File and Directory Selection</a>, Previous: <a href="Output-Line-Prefix-Control.html#Output-Line-Prefix-Control" accesskey="p" rel="prev">Output Line Prefix Control</a>, Up: <a href="Command_002dline-Options.html#Command_002dline-Options" accesskey="u" rel="up">Command-line Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> +</div> + - </body></html> +</body> +</html>
