From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id bc5c5c8d for ; Tue, 17 Dec 2019 01:21:41 +0000 (UTC) Received: (qmail 14050 invoked by alias); 17 Dec 2019 01:21:35 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24561 Received: (qmail 17386 invoked by uid 1010); 17 Dec 2019 01:21:35 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25663. spamassassin: 3.4.2. Clear:RC:0(66.111.4.25):SA:0(-2.6/5.0):. Processed in 1.367142 secs); 17 Dec 2019 01:21:35 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujggfsehttd dttddtredvnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddukedtrdehjedrudduleenuc frrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgr mhgvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Date: Tue, 17 Dec 2019 01:20:50 +0000 From: Daniel Shahaf To: zsh-users@zsh.org Subject: Re: Glob and grep Message-ID: <20191217012050.w6rq5xrc24qpgo3i@tarpaulin.shahaf.local2> References: <15c62c86-5b55-e248-725f-4ecbfe73822d@goots.org> <20191216232427.nssq2c66q75aluhn@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191216232427.nssq2c66q75aluhn@gmx.de> User-Agent: NeoMutt/20170113 (1.7.2) Dominik Vogt wrote on Tue, Dec 17, 2019 at 00:24:27 +0100: > On 12/16/19, Nick Cross wrote: > > While I've been able to find varying amounts of information on the net I > > haven't found quite enough to get the following working. > > > > I would like to condense the following into a single grep / glob > > expression where I search recursively through a directory tree, ignoring > > any sub-trees starting with 'test' or 'target'. > > > > grep **/*.groovy | egrep -v "(/test/|/target/)" > > Or a zsh-less solution: > > $ grep -R --include="*.groovy" --exclude-dir=test --exclude-dir=target a . If the tree is in version control, there's another way: rm -rf **/(test|target)(N) grep needle **/.haystack