delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/03/24/04:55:50

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=o/zjnyZ6+AYJs6ePaHW7GmUzk+E0b8AE44QNOYA95FCIELPJbVrfT
5MywHCwdSGkM3y1Ke/lsNgrFyb8lMB4urrYfR5KEyJqkF/T62znmcX0iYMD0MH8E
mygLfyz9J8ZHkmfHwsJ6VZZTRwPxJMFfDtbCqfMvPMx3bwWodOlrOk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=jExFulRGixUMm3XV6g1HdR/bILY=; b=kdZbzS26/EuZ00gl7W613jrCSkIB
lyywFRW0Q5MgBipaC0Bv3mkUnHtEzqjqwwNxQsOmeqBOFVPey9XwNWJlq1TmofN0
rlXKeNHfa921l8SdNdpcsiVd85Wr4f1XYNhuffDUKYLU7loOSx857h4brreOuqjb
zSUufW8UxafacCU=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL,BAYES_40 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Tue, 24 Mar 2015 09:55:31 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Altered behaviour of grep
Message-ID: <20150324085531.GA20480@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <9D9AC45310887B40A7245734E850FBE1125C0E20 AT FS-MX02 DOT frontier DOT local>
MIME-Version: 1.0
In-Reply-To: <9D9AC45310887B40A7245734E850FBE1125C0E20@FS-MX02.frontier.local>
User-Agent: Mutt/1.5.23 (2014-03-12)

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 recove=
r 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
  $=20

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

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

--6TrnltStXW4iwmi0
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVESaDAAoJEPU2Bp2uRE+gYjYP/0xbV5Pj6RbbI0x+Stjyr3Oh
F7gVjL7nl0v4hJveRJl51jiWYj/TE91ZPh3c74BBLEY/VFrBTCtWXBMPO+4Px0vR
9lqsTnMldwLwBh7kvm42LhMCUlSU3PJw3Zk4tL2cIktgHO2nd2b4GkGTPMHfhFLE
mr1dbIK7sLSCg9Ugo/mbmBbquq7Wkj9pn7hM6rxI1dNaum517awg/h41QwWukRg1
zuhPIswGvWxgh9S06ZC8w6b0PR07bNJ0sk6w0oj8SChxWOGTItK+0scfqoyecE4o
lCscKRhMhfaWZ4uSImWOa2YPJFHLOdtgjonv+B4e7J19mKNaf/su6bHm9UtqeKZz
ir5MFVJMyV5oteqQD0ZPQjHd8ckv8cfxWRHid0+mGNLMPsidouGz7ROky62pPD2J
adivep37AlYDmrQufLO8vmZZiEQi9vjHpKUyCXknam38xtS+0VAQhMHV9h895OHE
5aIe320ViHrt6dpuKPKe5h7NUdEdYH5tKr5fdvjshlBzxm6OR3IJdXstvVMrJLUO
2nXTG4uc2Dumv3PpTVw7HSWZnbJpV0n9iWXW7GcMqjy9WCP+Jca9FwiTVrU9E0hA
Uw1X9c2c/hNNXDG52MokrKuImqJiCQhZtbRi8H0745RJzxzvRmW2Dxag5Sl+x3Bv
Ei74y5XFX8ErhHg90D/s
=3/gj
-----END PGP SIGNATURE-----

--6TrnltStXW4iwmi0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019