From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 12 16:04:26 2012 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 50BB01065670 for ; Thu, 12 Apr 2012 16:04:26 +0000 (UTC) (envelope-from dubiousjim@gmail.com) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 18B488FC22 for ; Thu, 12 Apr 2012 16:04:26 +0000 (UTC) Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 84024214AE for ; Thu, 12 Apr 2012 12:04:25 -0400 (EDT) Received: from web4.nyi.mail.srv.osa ([10.202.2.214]) by compute1.internal (MEProxy); Thu, 12 Apr 2012 12:04:25 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:cc:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=smtpout; bh=qiUARRYTb462zQuRXut6+nl+q1Y=; b=Ytb6A /wvFRClDMSi6CMMprNFAzbD5zNUTn5aPRaF9vaz7nNMsaBVzai8CLqkegi/p5hSI k86yLtQQUnE3RlcDDbvwuIxCE1AayWinZyoEJM+jbkigcdnXZPfVeVUAbuTvB60C Oqy8g9DLC+EXOwJSGTm43etrGyFJEEUxw5MJ+M= Received: by web4.nyi.mail.srv.osa (Postfix, from userid 99) id 6458F3C1EAD; Thu, 12 Apr 2012 12:04:25 -0400 (EDT) Message-Id: <1334246665.18249.140661061548761.71AC8C8A@webmail.messagingengine.com> X-Sasl-Enc: of+VwZEp4ECTD5mjLgVS58+BC8LtpQBgVYgws1UOc5kZ 1334246665 From: Jim Pryor To: "John D. Hendrickson and Sara Darnell" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface Date: Thu, 12 Apr 2012 12:04:25 -0400 In-Reply-To: <1334245024.11829.140661061535169.6EEC2FD8@webmail.messagingengine.com> References: <201204120410.q3C4ACqg071289@freefall.freebsd.org> <4F86F142.2010401@cox.net> <1334245024.11829.140661061535169.6EEC2FD8@webmail.messagingengine.com> Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/166842: bsdgrep(1) inconsistently handles ^ in non-anchoring positions X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2012 16:04:26 -0000 On Thu, Apr 12, 2012, at 11:37 AM, Jim Pryor wrote: > On Thu, Apr 12, 2012, at 11:14 AM, John D. Hendrickson and Sara Darnell > wrote: > > Your problem is incorrect so there is no sol'n. > > > > printf 'abc def' | grep -o '^[a-z]' > > > > is only supposed to match against abc. > > > > see grep(1) about pattern matching - there is plenty of online writeups, > > esp posix ieee std. see > > also "ant / antlr" for more about patterns and matching. > > > > Jim Pryor wrote: > > > The following reply was made to PR bin/166842; it has been noted by GNATS. > > > From: Jim Pryor > > > $ printf 'abc def' | grep -o '^[a-z]' > > > will match against each of the letters in 'abc', but not against any of > > > the letters in 'def'. > > > dubiousjim@gmail.com > > > Hi John, I'm sorry I didn't describe the problem adequately to prevent > this misunderstanding. > $ printf 'abc def' | grep -o '^[a-z]' > Expected output: a > That is in fact the output I get from Gnu grep. > Actual output on FreeBSD: > a > b > c > > The matches against "b" and "c" are incorrect. The text you quoted was intended to point out that the erroneous behavior only extends to the end of the first word, not to all the characters on the matched line. -- dubiousjim@gmail.com