delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/07/16/21:29:39

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:mime-version:date:message-id:subject:from:to
:content-type; q=dns; s=default; b=SZ/it7B3KP7gIEVdGwLY2VT4Ka1gv
7JibeAdUL7h+i7Xx/T8L1lhLw2vWHTyFnubhMzMot/rI+iuBeog8YIUFrL/HPwEG
2aC4MFe1IH4mxLdzA7N7JxMKi1sWmdc/998oCODVdzSmaPNDYYukj1JrctU/uEk4
1gKX/F1y2olyDQ=
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:mime-version:date:message-id:subject:from:to
:content-type; s=default; bh=EEBkRH/j/TA3jOXsLtFq4e49uHM=; b=jp8
SXbSSbLGmPzzb+Av5VBbcFRfr3hU5DbsJdmXHpVbIng3YGEysAFPyqXVOkkx7Qzf
j+y6qXTxntSu3jlgU9nmHwYPmPUfOZ5dimGm38ayiXNDpSqWkdN5uJMRTxdCKLv5
u5aSolM54tzvEiKudMCl12VQgm7iqmqOT0EMjz+8=
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=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-ig0-f173.google.com
MIME-Version: 1.0
X-Received: by 10.107.160.196 with SMTP id j187mr13886219ioe.80.1437096558392; Thu, 16 Jul 2015 18:29:18 -0700 (PDT)
Date: Thu, 16 Jul 2015 20:29:18 -0500
Message-ID: <CAAXzdLWo4nvaJBMOBYsOYeCdrgw_O=8CM_H_kwfxnU=AqnuOjA@mail.gmail.com>
Subject: --line-regexp option with null data
From: Steven Penny <svnpenn AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Consider this command:

    printf 'alpha\nbravo\ncharlie\n' | grep --line-regexp --quiet bravo

grep sees 3 lines separated by newline, and matches the bravo line. Now consider
this command:

    printf 'alpha\0bravo\0charlie\0' | grep --line-regexp --quiet bravo

My thinking tells me that because I have not used `--null-data`, grep should see
1 or even 0 lines separated by newline, and fail to match a `bravo` followed by
newline. However it does not, it succeeds just like the first command, why is
this?

Note I also tried this on Debian with Grep 2.2 and it works as expected.

http://stackoverflow.com/q/31467045

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

- Raw text -


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