CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 15/11/02 02:54:37
Index: grep.html =================================================================== RCS file: /webcvs/grep/grep/manual/grep.html,v retrieving revision 1.20 retrieving revision 1.21 diff -u -b -r1.20 -r1.21 --- grep.html 23 Nov 2014 22:23:28 -0000 1.20 +++ grep.html 2 Nov 2015 02:54:28 -0000 1.21 @@ -1,15 +1,15 @@ <html lang="en"> <head> -<title>GNU Grep 2.21</title> +<title>GNU Grep 2.22</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<meta name="description" content="GNU Grep 2.21"> +<meta name="description" content="GNU Grep 2.22"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="top" href="#Top"> <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-2002, 2005, 2008-2014 Free Software Foundation, +Copyright (C) 1999-2002, 2005, 2008-2015 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this @@ -31,9 +31,10 @@ 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> -<h1 class="settitle">GNU Grep 2.21</h1> +<h1 class="settitle">GNU Grep 2.22</h1> <div class="contents"> <h2>Table of Contents</h2> <ul> @@ -91,11 +92,11 @@ <p><samp><span class="command">grep</span></samp> prints lines that contain a match for a pattern. - <p>This manual is for version 2.21 of GNU Grep. + <p>This manual is for version 2.22 of GNU Grep. <p>This manual is for <samp><span class="command">grep</span></samp>, a pattern matching engine. - <p>Copyright © 1999–2002, 2005, 2008–2014 Free Software Foundation, + <p>Copyright © 1999-2002, 2005, 2008-2015 Free Software Foundation, Inc. <blockquote> @@ -534,12 +535,18 @@ or if its data read before a line is selected for output, indicate that the file contains binary data, assume that the file is of type <var>type</var>. -By default, <var>type</var> is ‘<samp><span class="samp">binary</span></samp>’, +Non-text bytes indicate binary data; these are either data bytes +improperly encoded for the current locale, or null bytes when the +<samp><span class="option">-z</span></samp> (<samp><span class="option">--null-data</span></samp>) option is not given (see <a href="#Other-Options">Other Options</a>). + + <p>By default, <var>type</var> is ‘<samp><span class="samp">binary</span></samp>’, and <samp><span class="command">grep</span></samp> normally outputs either a one-line message saying that a binary file matches, or no message if there is no match. -When matching binary data, <samp><span class="command">grep</span></samp> may treat non-text -bytes as line terminators. +When processing binary data, <samp><span class="command">grep</span></samp> may treat non-text bytes +as line terminators; for example, the pattern ‘<samp><span class="samp">.</span></samp>’ (period) might +not match a null byte, as the null byte might be treated as a line +terminator even without the <samp><span class="option">-z</span></samp> (<samp><span class="option">--null-data</span></samp>) option. <p>If <var>type</var> is ‘<samp><span class="samp">without-match</span></samp>’, <samp><span class="command">grep</span></samp> assumes that a binary file does not match; @@ -602,6 +609,7 @@ read and process all files in that directory, recursively. Follow symbolic links on the command line, but skip symlinks that are encountered recursively. +Note that if no file operand is given, grep searches the working directory. This is the same as the ‘<samp><span class="samp">--directories=recurse</span></samp>’ option. <br><dt><samp><span class="option">-R</span></samp><dt><samp><span class="option">--dereference-recursive</span></samp><dd><a name="index-g_t_002dR-121"></a><a name="index-g_t_002d_002ddereference_002drecursive-122"></a><a name="index-recursive-search-123"></a><a name="index-searching-directory-trees-124"></a><a name="index-symbolic-links-125"></a>For each directory operand, read and process all files in that @@ -718,7 +726,14 @@ As this causes problems when writing portable scripts, this feature will be removed in a future release of <samp><span class="command">grep</span></samp>, and <samp><span class="command">grep</span></samp> warns if it is used. Please use an alias or script instead. - +For example, if <samp><span class="command">grep</span></samp> is in the directory ‘<samp><span class="samp">/usr/bin</span></samp>’ you +can prepend <samp><span class="file">$HOME/bin</span></samp> to your <samp><span class="env">PATH</span></samp> and create an +executable script <samp><span class="file">$HOME/bin/grep</span></samp> containing the following: + + <pre class="example"> #! /bin/sh + export PATH=/usr/bin + exec grep --color=auto --devices=skip "$@" +</pre> <br><dt><samp><span class="env">GREP_COLOR</span></samp><dd><a name="index-GREP_005fCOLOR-_0040r_007benvironment-variable_007d-142"></a><a name="index-highlight-markers-143"></a>This variable specifies the color used to highlight matched (non-empty) text. It is deprecated in favor of <samp><span class="env">GREP_COLORS</span></samp>, but still supported. The ‘<samp><span class="samp">mt</span></samp>’, ‘<samp><span class="samp">ms</span></samp>’, and ‘<samp><span class="samp">mc</span></samp>’ capabilities of <samp><span class="env">GREP_COLORS</span></samp> @@ -1437,7 +1452,8 @@ Therefore, merely using the <code>[:space:]</code> character class does not match newlines in the way you might expect. - <p>With the GNU <samp><span class="command">grep</span></samp> option <code>-z</code> (see <a href="#File-and-Directory-Selection">File and Directory Selection</a>), the input is terminated by null bytes. Thus, + <p>With the GNU <samp><span class="command">grep</span></samp> option <samp><span class="option">-z</span></samp> (<samp><span class="option">--null-data</span></samp>), each +input “line” is terminated by a null byte; see <a href="#Other-Options">Other Options</a>. Thus, you can match newlines in the input, but typically if there is a match the entire input is output, so this usage is often combined with output-suppressing options like <samp><span class="option">-q</span></samp>, e.g.:
