grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to grep/manual/html_node/File-and-Directory-Selection.html,v


From: Jim Meyering
Subject: Changes to grep/manual/html_node/File-and-Directory-Selection.html,v
Date: Fri, 22 Apr 2016 05:25:59 +0000

CVSROOT:        /webcvs/grep
Module name:    grep
Changes by:     Jim Meyering <meyering> 16/04/22 05:25:56

Index: html_node/File-and-Directory-Selection.html
===================================================================
RCS file: /webcvs/grep/grep/manual/html_node/File-and-Directory-Selection.html,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- html_node/File-and-Directory-Selection.html 11 Mar 2016 06:09:08 -0000      
1.23
+++ html_node/File-and-Directory-Selection.html 22 Apr 2016 05:25:55 -0000      
1.24
@@ -13,10 +13,10 @@
 "GNU Free Documentation License". -->
 <!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ -->
 <head>
-<title>GNU Grep 2.24: File and Directory Selection</title>
+<title>GNU Grep 2.25: File and Directory Selection</title>
 
-<meta name="description" content="GNU Grep 2.24: File and Directory Selection">
-<meta name="keywords" content="GNU Grep 2.24: File and Directory Selection">
+<meta name="description" content="GNU Grep 2.25: File and Directory Selection">
+<meta name="keywords" content="GNU Grep 2.25: File and Directory Selection">
 <meta name="resource-type" content="document">
 <meta name="distribution" content="global">
 <meta name="Generator" content="makeinfo">
@@ -88,17 +88,13 @@
 indicate that the file contains binary data,
 assume that the file is of type <var>type</var>.
 Non-text bytes indicate binary data; these are either output bytes that are
-improperly encoded for the current locale, or null input bytes when the
+improperly encoded for the current locale (see <a 
href="Environment-Variables.html#Environment-Variables">Environment 
Variables</a>), or null input bytes when the
 <samp>-z</samp> (<samp>--null-data</samp>) option is not given (see <a 
href="Other-Options.html#Other-Options">Other Options</a>).
 </p>
 <p>By default, <var>type</var> is &lsquo;<samp>binary</samp>&rsquo;, and when 
<code>grep</code>
 discovers that a file is binary it suppresses any further output, and
 instead outputs either a one-line message saying that a binary file
 matches, or no message if there is no match.
-When processing binary data, <code>grep</code> may treat non-text bytes
-as line terminators; for example, the pattern &lsquo;<samp>.</samp>&rsquo; 
(period) might
-not match a null byte, as the null byte might be treated as a line
-terminator even without the <samp>-z</samp> (<samp>--null-data</samp>) option.
 </p>
 <p>If <var>type</var> is &lsquo;<samp>without-match</samp>&rsquo;,
 when <code>grep</code> discovers that a file is binary
@@ -109,10 +105,23 @@
 <code>grep</code> processes a binary file as if it were text;
 this is equivalent to the <samp>-a</samp> option.
 </p>
-<p><em>Warning:</em> &lsquo;<samp>--binary-files=text</samp>&rsquo; might 
output binary garbage,
-which can have nasty side effects
-if the output is a terminal and
-if the terminal driver interprets some of it as commands.
+<p>When <var>type</var> is &lsquo;<samp>binary</samp>&rsquo;, 
<code>grep</code> may treat non-text
+bytes as line terminators even without the <samp>-z</samp>
+(<samp>--null-data</samp>) option.  This means choosing 
&lsquo;<samp>binary</samp>&rsquo;
+versus &lsquo;<samp>text</samp>&rsquo; can affect whether a pattern matches a 
file.  For
+example, when <var>type</var> is &lsquo;<samp>binary</samp>&rsquo; the pattern 
&lsquo;<samp>q$</samp>&rsquo; might
+match &lsquo;<samp>q</samp>&rsquo; immediately followed by a null byte, even 
though this
+is not matched when <var>type</var> is &lsquo;<samp>text</samp>&rsquo;.  
Conversely, when
+<var>type</var> is &lsquo;<samp>binary</samp>&rsquo; the pattern 
&lsquo;<samp>.</samp>&rsquo; (period) might not
+match a null byte.
+</p>
+<p><em>Warning:</em> The <samp>-a</samp> (<samp>--binary-files=text</samp>) 
option
+might output binary garbage, which can have nasty side effects if the
+output is a terminal and if the terminal driver interprets some of it
+as commands.  On the other hand, when reading files whose text
+encodings are unknown, it can be helpful to use <samp>-a</samp> or to set
+&lsquo;<samp>LC_ALL='C'</samp>&rsquo; in the environment, in order to find 
more matches
+even if the matches are unsafe for direct display.
 </p>
 </dd>
 <dt><samp>-D <var>action</var></samp></dt>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]