grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.18-103-gb73296a


From: Paul Eggert
Subject: grep branch, master, updated. v2.18-103-gb73296a
Date: Fri, 25 Apr 2014 04:24:51 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  b73296ace186451b096b075461634c153d1fa525 (commit)
      from  b642fb02a94c0f6b9ff47f2b62c7d8f11ea3f223 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=b73296ace186451b096b075461634c153d1fa525


commit b73296ace186451b096b075461634c153d1fa525
Author: Paul Eggert <address@hidden>
Date:   Thu Apr 24 21:24:22 2014 -0700

    misc: fix doc and test bugs re grep -z
    
    Problem reported by Stephane Chazelas in: http://bugs.gnu.org/16871
    * doc/grep.texi (Usage): Remove incorrect example with -P.
    * tests/pcre: Improve test so that it actually tests whether \s
    matches a newline.

diff --git a/doc/grep.texi b/doc/grep.texi
index f631f03..59d0d3c 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -1719,25 +1719,19 @@ How can I match across lines?
 
 Standard grep cannot do this, as it is fundamentally line-based.
 Therefore, merely using the @code{[:space:]} character class does not
-match newlines in the way you might expect.  However, if your grep is
-compiled with Perl patterns enabled, the Perl @samp{s}
-modifier (which makes @code{.} match newlines) can be used:
-
address@hidden
-printf 'foo\nbar\n' | grep -P '(?s)foo.*?bar'
address@hidden example
+match newlines in the way you might expect.
 
 With the GNU @command{grep} option @code{-z} (@pxref{File and
 Directory Selection}), the input is terminated by null bytes.  Thus,
-you can match newlines in the input, but the output will be the whole
-file, so this is really only useful to determine if the pattern is
-present:
+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 @option{-q}, e.g.:
 
 @example
 printf 'foo\nbar\n' | grep -z -q 'foo[[:space:]]\+bar'
 @end example
 
-Failing either of those options, you need to transform the input
+If this does not suffice, you can transform the input
 before giving it to @command{grep}, or turn to @command{awk},
 @command{sed}, @command{perl}, or many other utilities that are
 designed to operate across lines.
diff --git a/tests/pcre b/tests/pcre
index cbe6884..7efa560 100755
--- a/tests/pcre
+++ b/tests/pcre
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Ensure that with -P, \s*$ matches a newline.
+# Ensure that with -P, \s matches a newline.
 #
 # Copyright (C) 2001, 2006, 2009-2014 Free Software Foundation, Inc.
 #
@@ -12,7 +12,7 @@ require_pcre_
 
 fail=0
 
-# See CVS revision 1.32 of "src/search.c".
 echo | grep -P '\s*$' || fail=1
+echo | grep -zP '\s$' || fail=1
 
 Exit $fail

-----------------------------------------------------------------------

Summary of changes:
 doc/grep.texi |   16 +++++-----------
 tests/pcre    |    4 ++--
 2 files changed, 7 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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