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 82bfcb66 for ; Tue, 17 Dec 2019 07:32:13 +0000 (UTC) Received: (qmail 119 invoked by alias); 17 Dec 2019 07:31:42 -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: 24563 Received: (qmail 18712 invoked by uid 1010); 17 Dec 2019 07:31:41 -0000 X-Qmail-Scanner-Diagnostics: from ny007.relay.arandomserver.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(172.96.188.169):SA:0(-2.0/5.0):. Processed in 0.770193 secs); 17 Dec 2019 07:31:41 -0000 X-Envelope-From: nick@goots.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _ny-spf.arandomserver.com designates 172.96.188.169 as permitted sender) Subject: Re: Glob and grep To: Daniel Shahaf , zsh-users@zsh.org References: <15c62c86-5b55-e248-725f-4ecbfe73822d@goots.org> <20191216232427.nssq2c66q75aluhn@gmx.de> <20191217012050.w6rq5xrc24qpgo3i@tarpaulin.shahaf.local2> From: Nick Cross Message-ID: <5656de51-f1bc-5ebe-154f-fa8351825d06@goots.org> Date: Tue, 17 Dec 2019 07:31:04 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191217012050.w6rq5xrc24qpgo3i@tarpaulin.shahaf.local2> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-AuthUser: goots@goots.org X-Originating-IP: 172.96.184.4 X-SpamExperts-Domain: ams203.hawkhost.com X-SpamExperts-Username: relay Authentication-Results: arandomserver.com; auth=pass (login) smtp.auth=relay@ams203.hawkhost.com X-SpamExperts-Outgoing-Class: unsure X-SpamExperts-Outgoing-Evidence: Combined (0.47) X-Recommended-Action: accept X-Filter-ID: Mvzo4OR0dZXEDF/gcnlw0c2Pj46HODYmpAMVAv0J1pOpSDasLI4SayDByyq9LIhVFW+xNS0sg3mt EGRFHklho0TNWdUk1Ol2OGx3IfrIJKyP9eGNFz9TW9u+Jt8z2T3Kl1t3PxQdgOVB4KO7stALLVMK ReMCc0dEw1X25Fn6tCDxUx3C/fp45cNdLIhOyQtc58fMnqZUTt7CyKlJUh+zhpO83XWZ88kEQyFG rdZOVlfloW5O8nKi+aEgzCvYcGcNEi6bBF3FZGh7T35ujWkvPF94HqUgM1bIP630o6RuM97Y4qDj xTNYOyQQ60ki1nvvARsynxDH0D+SLDJWdESXzt3HlBLXAa0Td3DmRHXED0/mRtX1Hfs7Fb9Ao09H OUrSbsR08q9tEAjFm2byf+NztGKt9aGM6q9jDWAXjuUVl4FYtMGMa5fbJv5A+BF/uLnYhjtk6Y9I hhQDFdoIPzYkI8uxShj6Yb6py6c4ZvhEdw5wu+sCbQh+cJ54x7uTJHOaclfQPH0+ysbDHzIxbZDa bDovhtsLcuN3EUkPKi2288ChP7r/qeCcLfNPkwm2lNnsvr3LBR8rUYXJ4jh62pfHaKqsknzQ1WVE SSlbgJ6e928BIkUL/j1Y48GvmeURQjjEmWAUwrX20tzeVEIV3lMSSzeM7gmadZpfXwQQswIwnX6B YwwxWlITzt5BMTwvacO5YlFQ10AnvOoC+qwiPtMtJNziaW2MmIMRJwRSKV1G/kvEoN1swnpR3EMS 7wYDzhc2EgMl4ZUe5Dj7uhM4/N2xzLFWY/VfYxNumS89Mw+1V+O2erbiqQdV/TlKE/xdbhXRABN9 Mz1MMIxT+eu5Tv9euXLYM3A6BXfvel8OEFDbU53O7pa/VV5uCTlt9oVnYNrgjRlj3yw3nriVayT2 IaGuPuI9n0Z5GR7BAJif0OigbpKRDxHy7HLn0231TPAP2yw48iNAoBl8j+NxfqjWD0rlnO/Xn0pY /wWW7xfEbTwPHIiVhLORKaWHTWCHY+HD0m2pYvW0armO5xWTkeBkOn45EE6zsDpY51iF5liL5u5G Pk9was+00YlhfdVP7JnXaybx X-Report-Abuse-To: spam@se001.arandomserver.com On 17/12/2019 01:20, Daniel Shahaf wrote: > 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 > > Woah - the nuke it from orbit option!!