public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Altered behaviour of grep
@ 2015-03-24  8:43 Fergus Daly
  2015-03-24  8:55 ` Fergus Daly
  2015-03-24  9:04 ` Corinna Vinschen
  0 siblings, 2 replies; 3+ messages in thread
From: Fergus Daly @ 2015-03-24  8:43 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'; +Cc: Fergus Daly

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?
Thank you.
Fergus 

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Altered behaviour of grep
  2015-03-24  8:43 Altered behaviour of grep Fergus Daly
@ 2015-03-24  8:55 ` Fergus Daly
  2015-03-24  9:04 ` Corinna Vinschen
  1 sibling, 0 replies; 3+ messages in thread
From: Fergus Daly @ 2015-03-24  8:55 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'; +Cc: Fergus Daly

grep -Pl "\xmn"
used to find files containing the ASCII character mn. For instance
grep -PL "\x0d" or "\x0a" or usefully "\x00".
       ^
I did mean grep -Pl in both cases.
Fergus
 

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Altered behaviour of grep
  2015-03-24  8:43 Altered behaviour of grep Fergus Daly
  2015-03-24  8:55 ` Fergus Daly
@ 2015-03-24  9:04 ` Corinna Vinschen
  1 sibling, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2015-03-24  9:04 UTC (permalink / raw)
  To: cygwin

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-24  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24  8:43 Altered behaviour of grep Fergus Daly
2015-03-24  8:55 ` Fergus Daly
2015-03-24  9:04 ` Corinna Vinschen

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).