Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 52851) by debbugs.gnu.org; 28 Dec 2021 15:44:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 28 10:44:19 2021 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 To: kevinarpe@HIDDEN, 52851 <at> debbugs.gnu.org Subject: Re: bug#52851: git grep feature: boolean logic 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-Debbugs-Envelope-To: 52851 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
bug-grep@HIDDEN
:bug#52851
; Package grep
.
Full text available.Received: (at submit) by debbugs.gnu.org; 28 Dec 2021 14:55:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 28 09:55:50 2021 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> Subject: git grep feature: boolean logic To: bug-grep@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-Debbugs-Envelope-To: submit 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--
Kevin Connor Arpe <kevinarpe@HIDDEN>
:bug-grep@HIDDEN
.
Full text available.bug-grep@HIDDEN
:bug#52851
; Package grep
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.