CVSROOT: /web/grep Module name: grep Changes by: Karl Berry <karl> 09/05/24 18:43:01
Index: manual/html_node/Context-Line-Control.html =================================================================== RCS file: manual/html_node/Context-Line-Control.html diff -N manual/html_node/Context-Line-Control.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ manual/html_node/Context-Line-Control.html 24 May 2009 18:42:58 -0000 1.1 @@ -0,0 +1,80 @@ +<html lang="en"> +<head> +<title>Context Line Control - GNU Grep 2.5.4</title> +<meta http-equiv="Content-Type" content="text/html"> +<meta name="description" content="GNU Grep 2.5.4"> +<meta name="generator" content="makeinfo 4.13"> +<link title="Top" rel="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"> +<!-- +This manual is for `grep', a pattern matching engine. + +Copyright (C) 1999, 2000, 2001, 2002, 2005, 2008, 2009 Free +Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included + in the section entitled ``GNU Free Documentation License''. + --> +<meta http-equiv="Content-Style-Type" content="text/css"> +<style type="text/css"><!-- + pre.display { font-family:inherit } + pre.format { font-family:inherit } + pre.smalldisplay { font-family:inherit; font-size:smaller } + pre.smallformat { font-family:inherit; font-size:smaller } + pre.smallexample { font-size:smaller } + pre.smalllisp { font-size:smaller } + span.sc { font-variant:small-caps } + span.roman { font-family:serif; font-weight:normal; } + span.sansserif { font-family:sans-serif; font-weight:normal; } +--></style> +</head> +<body> +<div class="node"> +<a name="Context-Line-Control"></a> +<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> +</div> + +<h4 class="subsection">2.1.5 Context Line Control</h4> + +<p>Regardless of how these options are set, +<samp><span class="command">grep</span></samp> will never print any given line more than once. +If the ‘<samp><span class="samp">-o</span></samp>’ or ‘<samp><span class="samp">--only-matching</span></samp>’ option is specified, +these options have no effect and a warning is given upon their use. + + <dl> +<dt>‘<samp><span class="samp">-A </span><var>num</var></samp>’<dt>‘<samp><span class="samp">--after-context=</span><var>num</var></samp>’<dd><a name="index-g_t_002dA-76"></a><a name="index-g_t_002d_002dafter_002dcontext-77"></a><a name="index-after-context-78"></a><a name="index-context-lines_002c-after-match-79"></a>Print <var>num</var> lines of trailing context after matching lines. + + <br><dt>‘<samp><span class="samp">-B </span><var>num</var></samp>’<dt>‘<samp><span class="samp">--before-context=</span><var>num</var></samp>’<dd><a name="index-g_t_002dB-80"></a><a name="index-g_t_002d_002dbefore_002dcontext-81"></a><a name="index-before-context-82"></a><a name="index-context-lines_002c-before-match-83"></a>Print <var>num</var> lines of leading context before matching lines. + + <br><dt>‘<samp><span class="samp">-C </span><var>num</var></samp>’<dt>‘<samp><span class="samp">-</span><var>num</var></samp>’<dt>‘<samp><span class="samp">--context=</span><var>num</var></samp>’<dd><a name="index-g_t_002dC-84"></a><a name="index-g_t_002d_002dcontext-85"></a><a name="index-g_t_002d_0040var_007bnum_007d-86"></a><a name="index-context-87"></a>Print <var>num</var> lines of leading and trailing output context. + + </dl> + + <p>Matching lines normally use ‘<samp><span class="samp">:</span></samp>’ as a separator +between prefix fields and actual line content. +Context (i.e., non-matching) lines use ‘<samp><span class="samp">-</span></samp>’ instead. +When no context is specified, +matching lines are simply output one right after another. +When nonzero context is specified, +lines that are adjacent in the input form a group +and are output one right after another, +but disjoint groups of lines are separated by a ‘<samp><span class="samp">--</span></samp>’ +without any prefix and on a line of its own. +Each group may contain several matching lines +when they are close enough to each other +that two otherwise adjacent but divided groups connect +and can just merge into a single contiguous one. + + </body></html> +
