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:content-type :content-transfer-encoding:message-id:date:from:to:subject :in-reply-to:references; q=dns; s=default; b=I5TyQL+tooIcLzh1o+n FIvQChgwJGa2ie3TC75j44DDVl45m9aroI1TxtwMJkTWUrHI6jQsJo0yZPn+M2vk xdtsE2/AnrF0aAz4uLKoYsn8zy5sAekwED87Q1S7yBL9WIlSGgZlN+ZLlW0EQ7yO LD2W64ZLFal2CsFMy7kPYlK4= 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:content-type :content-transfer-encoding:message-id:date:from:to:subject :in-reply-to:references; s=default; bh=s06Por/EZ2/iHrrTnfqomE6jK xM=; b=YdAG+DHAyg5fflh3kJveHOPKkEe4uUHwJNdK/coSMhLZpc9MPFzpakNY2 U7GqKPXF3fgpPIAQvekpQi9Ar7veXgs7Qfll95gfQ20kufj1kRUz93pP4lHfxBQU azgAH9hv3ZsqLokyfJo1iArCG41QWG3ZX1GIXwf8CZQ7f3FQwA= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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_50,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: sneak2.sneakemail.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <6138-1437098652-808922@sneakemail.com> Date: Thu, 16 Jul 2015 20:04:10 -0600 From: "John Hein" <3fbmqnhaz4 AT snkmail DOT com> To: cygwin AT cygwin DOT com Subject: Re: --line-regexp option with null data In-Reply-To: References: Steven Penny svnpenn-at-gmail.com |cygwin_ml_nodigest| wrote at 20:29 -0500 on Jul 16, 2015: > 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 cygwin grep is detecting the input as binary which seems to be overriding the 'match the whole line' behavior of --line-regexp. Get rid of --quiet to see that. That does seem like a bug in the cygwin implementation of grep to me. As a workaround for this simple example, you can add -a (aka --text) to force it to treat the input as text. -- 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