CVSROOT: /web/grep Module name: grep Changes by: Karl Berry <karl> 09/05/24 18:43:01
Index: manual/html_node/Output-Line-Prefix-Control.html =================================================================== RCS file: manual/html_node/Output-Line-Prefix-Control.html diff -N manual/html_node/Output-Line-Prefix-Control.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ manual/html_node/Output-Line-Prefix-Control.html 24 May 2009 18:42:59 -0000 1.1 @@ -0,0 +1,114 @@ +<html lang="en"> +<head> +<title>Output Line Prefix 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="General-Output-Control.html#General-Output-Control" title="General Output Control"> +<link rel="next" href="Context-Line-Control.html#Context-Line-Control" title="Context Line Control"> +<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="Output-Line-Prefix-Control"></a> +<p> +Next: <a rel="next" accesskey="n" href="Context-Line-Control.html#Context-Line-Control">Context Line Control</a>, +Previous: <a rel="previous" accesskey="p" href="General-Output-Control.html#General-Output-Control">General Output 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.4 Output Line Prefix Control</h4> + +<p>When several prefix fields are to be output, +the order is always file name, line number, and byte offset, +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 +before each line of output. +If ‘<samp><span class="samp">-o</span></samp>’ (‘<samp><span class="samp">--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, +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; +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. +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. +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 +as input coming from file <var>LABEL</var>. +This is especially useful for tools like <samp><span class="command">zgrep</span></samp>; +e.g.: + + <pre class="example"> gzip -cd foo.gz | grep --label=foo 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="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, +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>’. +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. +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. + + <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) +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 +instead of the usual newline. +This option makes the output unambiguous, +even in the presence of file names containing unusual characters like newlines. +This option can be used with commands like +‘<samp><span class="samp">find -print0</span></samp>’, ‘<samp><span class="samp">perl -0</span></samp>’, ‘<samp><span class="samp">sort -z</span></samp>’, and ‘<samp><span class="samp">xargs -0</span></samp>’ +to process arbitrary file names, +even those that contain newline characters. + + </dl> + + </body></html> +
