X-Loop: help-debbugs@HIDDEN Subject: bug#52851: git grep feature: boolean logic Resent-From: Kevin Connor Arpe <kevinarpe@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Tue, 28 Dec 2021 14:56:01 +0000 Resent-Message-ID: <handler.52851.B.164070335032029 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 52851 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 52851 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-grep@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.164070335032029 (code B ref -1); Tue, 28 Dec 2021 14:56:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Dec 2021 14:55:50 +0000 Received: from localhost ([127.0.0.1]:47175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1n2DtF-0008KX-Ng for submit <at> debbugs.gnu.org; Tue, 28 Dec 2021 09:55:50 -0500 Received: from lists.gnu.org ([209.51.188.17]:45406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <kevinarpe@HIDDEN>) id 1n2DtD-0008KQ-CB for submit <at> debbugs.gnu.org; Tue, 28 Dec 2021 09:55:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <kevinarpe@HIDDEN>) id 1n2DtC-0000cs-UG for bug-grep@HIDDEN; Tue, 28 Dec 2021 09:55:47 -0500 Received: from [2607:f8b0:4864:20::332] (port=36800 helo=mail-ot1-x332.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <kevinarpe@HIDDEN>) id 1n2DtB-0006jq-4j for bug-grep@HIDDEN; Tue, 28 Dec 2021 09:55:46 -0500 Received: by mail-ot1-x332.google.com with SMTP id s21-20020a05683004d500b0058f585672efso19898881otd.3 for <bug-grep@HIDDEN>; Tue, 28 Dec 2021 06:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=eQ8j9ZisC7531v5hqP3VpcWRyZ+E4x17NdsUWvUB354=; b=hqmnNqY3JC26+YOuknJgZBMlFQZlWMJuJIEFZ1//Y99y4uGUsUpX1vJBt+9l01y/G+ 7mAM6eFsfsSWhyQOgMH6NJkZXnMoNnOSgJVH8iI2j/mS5UlhpthNYdF3GjgR9Zvxo/JN Y6L4ALXNrBSNIk1BPidApSklhB8tas3pj4GTJwg4JlZXrbwCF/h6xqCe/GRZS8xdyWex I1QDp+Nuby9+lwdLvRbuGBjlUa343cQaj7skvfOLit64ciEF/14ubjU/iM59sUxBIVr7 ft9PMJiwqzSXJcwDRxlltUmhlGHQyij0gkUuiG6HwoVOcBmm8BWrwN90Uq83mZ6xn5pJ Hzeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=eQ8j9ZisC7531v5hqP3VpcWRyZ+E4x17NdsUWvUB354=; b=6pexRRInTahOLJCcnegKJMUozVBPfh2I9aqYz5Jufbg/rgodpKS4UTLJ5AKMc0aTP1 7ygn1GOx1t8HnHtGUKcKOxq6BqIP+8uG8ddX0AC5ISN1dzulSecDp1SWdST5sQhrE9Ha CH2brKB5QiVcGIUlPwCyL7GhwP8WvHERYKv7aJGKlOS7kV55ojygUf8aPT15l91fvXo6 6JIsnI013iakrS0NBCsq94k5j1oDJd7mGAVI+Sv4FHaha7EvjOco2uLmIBpdWgRtY9SF f2O79X6nhvzqp+NQmYU3L04nQsDAiMgTooyP8jsiOAMa2C12s11GU0lHvt4Ns11oDFb4 B87w== X-Gm-Message-State: AOAM533PXMyzpHkRc7D6aUt16zbUV/+XH4JXqpuBo8Gz+i8NlhFBILnx g34+k06vOcDiSvjA617Rm+wgx6bsmNUXQ5RIlCn/2B/c5Chzew== X-Google-Smtp-Source: ABdhPJypBjJDDaxjeSfAhWc8FwUMTZSLUKXsX28sdlp2coXqVOS2NQuLXdlBEU1KXKodmEV45zcqTWmMH6b82cp9N2Q= X-Received: by 2002:a9d:200f:: with SMTP id n15mr15455863ota.66.1640703343246; Tue, 28 Dec 2021 06:55:43 -0800 (PST) MIME-Version: 1.0 From: Kevin Connor Arpe <kevinarpe@HIDDEN> Date: Tue, 28 Dec 2021 22:55:32 +0800 Message-ID: <CAFMYRRNq4UbmD=XMEfHhVT_v52SC=W4KMpfXnDvRZd5_=MdRDg@HIDDEN> Content-Type: multipart/alternative; boundary="000000000000f4bf7b05d4360333" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::332 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=kevinarpe@HIDDEN; helo=mail-ot1-x332.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) --000000000000f4bf7b05d4360333 Content-Type: text/plain; charset="UTF-8" Hello, Recently, I was stumped with a difficult grep problem: I needed to filter files containing more than one regex (think: logical-and). I didn't know how to do this using only a single invocation of GNU grep. (Please correct me if I am wrong.) A bunch of Googling led me to discover that git has a grep sub-command that implements boolean logic with and/or/not/parens operators. Manpage: https://git-scm.com/docs/git-grep, Source: https://github.com/git/git/blob/master/grep.c At the moment, it's not possible to use git grep very well outside of git repositories. There are some issues around absolute and relative paths, plus "git working directory". Eventually, I settled on writing a crude shell script that wraps GNU grep to provide similar functionality. However, I am aware of its inefficiency, as it requires multiple invocations of grep. Are people aware of this very cool grep feature with boolean logic? I tried to search the GNU grep message archive, but I didn't see any discussion about it. I'm curious what the GNU grep team thinks about this feature. Kind regards, Kevin Arpe Hongkong --000000000000f4bf7b05d4360333 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hello,<div><br></div><div>Recently, I was stumped with a d= ifficult grep problem: I needed to filter files containing more than one re= gex (think: logical-and).=C2=A0 I didn't know how to do this using only= a single invocation of GNU grep.=C2=A0 (Please correct me if I am wrong.)<= /div><div><br></div><div>A bunch of Googling led me to discover that git ha= s a grep sub-command that implements boolean logic with and/or/not/parens o= perators.=C2=A0 Manpage:=C2=A0<a href=3D"https://git-scm.com/docs/git-grep"= target=3D"_blank">https://git-scm.com/docs/git-grep</a>, Source:=C2=A0<a h= ref=3D"https://github.com/git/git/blob/master/grep.c">https://github.com/gi= t/git/blob/master/grep.c</a></div><div><br></div><div>At the moment, it'= ;s not possible to use git grep very well outside of git repositories.=C2= =A0 There are some issues around absolute and relative paths, plus "gi= t working directory".</div><div><br></div><div>Eventually, I settled o= n writing a crude shell script that wraps GNU grep to provide similar funct= ionality.=C2=A0 However, I am aware of its inefficiency, as it requires mul= tiple invocations of grep.</div><div><br></div><div>Are people aware=C2=A0o= f this very cool grep feature with boolean=C2=A0logic?=C2=A0 I tried to sea= rch the GNU grep message archive, but I didn't see any discussion about= it.=C2=A0 I'm curious what the GNU grep team thinks about this feature= .<br></div><div><br></div><div>Kind regards,</div><div>Kevin Arpe</div><div= >Hongkong</div></div> --000000000000f4bf7b05d4360333--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Kevin Connor Arpe <kevinarpe@HIDDEN> Subject: bug#52851: Acknowledgement (git grep feature: boolean logic) Message-ID: <handler.52851.B.164070335032029.ack <at> debbugs.gnu.org> References: <CAFMYRRNq4UbmD=XMEfHhVT_v52SC=W4KMpfXnDvRZd5_=MdRDg@HIDDEN> X-Gnu-PR-Message: ack 52851 X-Gnu-PR-Package: grep Reply-To: 52851 <at> debbugs.gnu.org Date: Tue, 28 Dec 2021 14:56:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-grep@HIDDEN If you wish to submit further information on this problem, please send it to 52851 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 52851: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D52851 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#52851: git grep feature: boolean logic Resent-From: arnold@HIDDEN Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Tue, 28 Dec 2021 15:45:01 +0000 Resent-Message-ID: <handler.52851.B52851.16407062594340 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 52851 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: kevinarpe@HIDDEN, 52851 <at> debbugs.gnu.org Received: via spool by 52851-submit <at> debbugs.gnu.org id=B52851.16407062594340 (code B ref 52851); Tue, 28 Dec 2021 15:45:01 +0000 Received: (at 52851) by debbugs.gnu.org; 28 Dec 2021 15:44:19 +0000 Received: from localhost ([127.0.0.1]:47240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1n2EeB-00017w-42 for submit <at> debbugs.gnu.org; Tue, 28 Dec 2021 10:44:19 -0500 Received: from freefriends.org ([96.88.95.60]:34640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <arnold@HIDDEN>) id 1n2Ee8-00017j-Lz for 52851 <at> debbugs.gnu.org; Tue, 28 Dec 2021 10:44:17 -0500 X-Envelope-From: arnold@HIDDEN Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 1BSFiEgl009253 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Dec 2021 08:44:15 -0700 Received: (from arnold@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 1BSFiEbV009252; Tue, 28 Dec 2021 08:44:14 -0700 From: arnold@HIDDEN Message-Id: <202112281544.1BSFiEbV009252@HIDDEN> X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to arnold@HIDDEN using -f Date: Tue, 28 Dec 2021 08:44:14 -0700 References: <CAFMYRRNq4UbmD=XMEfHhVT_v52SC=W4KMpfXnDvRZd5_=MdRDg@HIDDEN> In-Reply-To: <CAFMYRRNq4UbmD=XMEfHhVT_v52SC=W4KMpfXnDvRZd5_=MdRDg@HIDDEN> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Hi. You may want a different tool: awk '/pattern1/ && /pattern2/' ... awk '/pattern1/ || /pattern2/' ... awk '/pattern1/ && !/pattern2/' ... And so on. Seems much easier than stuffing boolean logic into grep. Just a thought, Arnold Kevin Connor Arpe <kevinarpe@HIDDEN> wrote: > Hello, > > Recently, I was stumped with a difficult grep problem: I needed to filter > files containing more than one regex (think: logical-and). I didn't know > how to do this using only a single invocation of GNU grep. (Please correct > me if I am wrong.) > > A bunch of Googling led me to discover that git has a grep sub-command that > implements boolean logic with and/or/not/parens operators. Manpage: > https://git-scm.com/docs/git-grep, Source: > https://github.com/git/git/blob/master/grep.c > > At the moment, it's not possible to use git grep very well outside of git > repositories. There are some issues around absolute and relative paths, > plus "git working directory". > > Eventually, I settled on writing a crude shell script that wraps GNU grep > to provide similar functionality. However, I am aware of its inefficiency, > as it requires multiple invocations of grep. > > Are people aware of this very cool grep feature with boolean logic? I > tried to search the GNU grep message archive, but I didn't see any > discussion about it. I'm curious what the GNU grep team thinks about this > feature. > > Kind regards, > Kevin Arpe > Hongkong
Received: (at control) by debbugs.gnu.org; 28 Dec 2021 17:39:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 28 12:39:07 2021 Received: from localhost ([127.0.0.1]:47334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1n2GRH-0003wc-5h for submit <at> debbugs.gnu.org; Tue, 28 Dec 2021 12:39:07 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:43344) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1n2GRE-0003w7-Sf for control <at> debbugs.gnu.org; Tue, 28 Dec 2021 12:39:05 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id ED93B1600BC for <control <at> debbugs.gnu.org>; Tue, 28 Dec 2021 09:38:57 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id nBUxk7QxP2N2 for <control <at> debbugs.gnu.org>; Tue, 28 Dec 2021 09:38:57 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5E337160137 for <control <at> debbugs.gnu.org>; Tue, 28 Dec 2021 09:38:57 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 61ovFYfZYm9S for <control <at> debbugs.gnu.org>; Tue, 28 Dec 2021 09:38:57 -0800 (PST) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3F4801600BC for <control <at> debbugs.gnu.org>; Tue, 28 Dec 2021 09:38:57 -0800 (PST) Message-ID: <beb1c504-c00c-3163-0d8f-985128c25a2c@HIDDEN> Date: Tue, 28 Dec 2021 09:38:56 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Content-Language: en-US To: control <at> debbugs.gnu.org From: Paul Eggert <eggert@HIDDEN> Subject: 52851 is wishlist Organization: UCLA Computer Science Department Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) severity 52851 wishlist
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.