From debbugs-submit-bounces@debbugs.gnu.org Sat May 13 01:56:16 2017 Received: (at submit) by debbugs.gnu.org; 13 May 2017 05:56:17 +0000 Received: from localhost ([127.0.0.1]:41678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9Q2K-0000o8-Ng for submit@debbugs.gnu.org; Sat, 13 May 2017 01:56:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55293) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9PKk-0008AD-Ny for submit@debbugs.gnu.org; Sat, 13 May 2017 01:11:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9PKe-0001dx-QZ for submit@debbugs.gnu.org; Sat, 13 May 2017 01:11:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d9PKe-0001dj-Mk for submit@debbugs.gnu.org; Sat, 13 May 2017 01:11:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9PKd-0005hR-Lc for bug-grep@gnu.org; Sat, 13 May 2017 01:11:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9PKX-0001ZO-OI for bug-grep@gnu.org; Sat, 13 May 2017 01:11:04 -0400 Received: from mx2.xecu.net ([216.127.136.244]:59417 helo=mail2.xecu.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d9PKX-0001VT-J3 for bug-grep@gnu.org; Sat, 13 May 2017 01:11:01 -0400 Received: from mail2.xecu.net (localhost [127.0.0.1]) by mail2.xecu.net (Postfix) with ESMTP id 62B54892814 for ; Sat, 13 May 2017 01:10:53 -0400 (EDT) X-Virus-Scanned: amavisd-new at xecu.net Received: from webmail.xecu.net (webmail.xecu.net [216.127.136.160]) (Authenticated sender: la-notifications@xecu.net) by mail2.xecu.net (Postfix) with ESMTPA id 665F6892822 for ; Sat, 13 May 2017 01:10:52 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 13 May 2017 01:10:52 -0400 From: LA-notifications@xecu.net To: bug-grep@gnu.org Subject: Wishlist: Tell grep to stop when a line matches something else. Message-ID: X-Sender: LA-notifications@xecu.net User-Agent: Roundcube Webmail/1.0.7 X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 13 May 2017 01:56:15 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hello. I wish I could tell grep to stop searching in a file when it gets to a line matching something else. So if grep is searching a file for 'foo' then finds a line matching 'bar', stop searching for 'foo'. It would help me out a lot when searching for things in my perl modules where I do not want my perl pod searched. LA From debbugs-submit-bounces@debbugs.gnu.org Sat May 13 02:36:18 2017 Received: (at 26904) by debbugs.gnu.org; 13 May 2017 06:36:18 +0000 Received: from localhost ([127.0.0.1]:41700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9Qf3-0001hz-On for submit@debbugs.gnu.org; Sat, 13 May 2017 02:36:17 -0400 Received: from gateway30.websitewelcome.com ([50.116.126.1]:39658) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9Qf1-0001hp-8c for 26904@debbugs.gnu.org; Sat, 13 May 2017 02:36:15 -0400 Received: from cm3.websitewelcome.com (unknown [108.167.139.23]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 0090A11CF9 for <26904@debbugs.gnu.org>; Sat, 13 May 2017 01:36:13 -0500 (CDT) Received: from gator4065.hostgator.com ([192.185.4.76]) by cm3.websitewelcome.com with id KiX91v0021eQXhs01iXANY; Sat, 13 May 2017 01:31:12 -0500 Received: from igld-84-229-99-155.inter.net.il ([84.229.99.155]:33444 helo=telaviv1.shlomifish.org) by gator4065.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1d9Qa4-000LyW-Mu; Sat, 13 May 2017 01:31:08 -0500 Received: from telaviv1.shlomifish.org (telaviv1.shlomifish.org [127.0.0.1]) by telaviv1.shlomifish.org (Postfix) with ESMTP id 63103260040; Sat, 13 May 2017 09:31:06 +0300 (IDT) Date: Sat, 13 May 2017 09:31:05 +0300 From: Shlomi Fish To: LA-notifications@xecu.net Subject: Re: bug#26904: Wishlist: Tell grep to stop when a line matches something else. Message-ID: <20170513093105.31f48ce5@telaviv1.shlomifish.org> In-Reply-To: References: X-Mailer: Claws Mail 3.15.0 (GTK+ 2.24.31; x86_64-mageia-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4065.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - shlomifish.org X-BWhitelist: no X-Source-IP: 84.229.99.155 X-Exim-ID: 1d9Qa4-000LyW-Mu X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: igld-84-229-99-155.inter.net.il (telaviv1.shlomifish.org) [84.229.99.155]:33444 X-Source-Auth: shlomif@shlomifish.org X-Email-Count: 2 X-Source-Cap: c2hsb21pZjtzaGxvbWlmO2dhdG9yNDA2NS5ob3N0Z2F0b3IuY29t X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 26904 Cc: 26904@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Hi LA, On Sat, 13 May 2017 01:10:52 -0400 LA-notifications@xecu.net wrote: > Hello. >=20 > I wish I could tell grep to stop searching in a file when it gets to a=20 > line matching something else. So if grep is searching a file for 'foo'=20 > then finds a line matching 'bar', stop searching for 'foo'. It would=20 > help me out a lot when searching for things in my perl modules where I=20 > do not want my perl pod searched. >=20 It may be out of the scope of GNU grep, but should be doable in perl -ln or= sed. E.g (untested): perl -ln -E '/bar/?exit:/foo/?say:0' Regards, Shlomi Fish > LA >=20 >=20 >=20 --=20 ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ http://www.shlomifish.org/humour/bits/facts/Emma-Watson/ A wiseman can learn from a fool much more than a fool can ever learn from a wiseman. =E2=80=94 http://en.wikiquote.org/wiki/Cato_the_Elder Please reply to list if it's a mailing list post - http://shlom.in/reply .