public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Altered behaviour of grep
Date: Tue, 24 Mar 2015 09:04:00 -0000	[thread overview]
Message-ID: <20150324085531.GA20480@calimero.vinschen.de> (raw)
In-Reply-To: <9D9AC45310887B40A7245734E850FBE1125C0E20@FS-MX02.frontier.local>

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

On Mar 24 08:07, Fergus Daly wrote:
> grep -Pl "\xmn"
> used to find files containing the ASCII character mn. For instance
> grep -PL "\x0d" or "\x0a" or usefully "\x00".
> This seems to have been lost with the current version.
> Is this an error? If not, can anybody tell me what new syntax will recover the old behaviour?

I just tested this on Cygwin and Fedora 21, both with grep 2.21:

  $ cat x.sh
  #!/bin/sh
  echo ${0##*/}
  $ grep -Pl '\x30' x.sh
  x.sh
  $ grep -Pl '\x0a' x.sh
  $ 

Same result on both systems, so it finds characters in lines, but not
the line separator itself.  If that worked before, this looks like an
upstream change to me.

A bit of digging shows this thread on the bug-grep mailing list:
http://lists.gnu.org/archive/html/bug-grep/2015-03/msg00015.html

And indeed, if I add a NUL byte to the file and search for it:

 $ grep -Pl '\x0' x.sh
 $ grep -aPl '\x0' x.sh
 x.sh

This does not work for the CR or LF, though.  You may want to discuss
this on the bug-grep ML.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

      parent reply	other threads:[~2015-03-24  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24  8:43 Fergus Daly
2015-03-24  8:55 ` Fergus Daly
2015-03-24  9:04 ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150324085531.GA20480@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).