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 b4f61941 for ; Tue, 17 Dec 2019 07:32:47 +0000 (UTC) Received: (qmail 3285 invoked by alias); 17 Dec 2019 07:31:49 -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: 24564 Received: (qmail 16820 invoked by uid 1010); 17 Dec 2019 07:31:49 -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.782307 secs); 17 Dec 2019 07:31:49 -0000 X-Envelope-From: zsh@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: Mikael Magnusson , Nick Cross References: <15c62c86-5b55-e248-725f-4ecbfe73822d@goots.org> Cc: Zsh Users From: Nick Cross Message-ID: <6f9d6ba5-3a24-e266-6b62-9473536b4a7f@goots.org> Date: Tue, 17 Dec 2019 07:31:12 +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: 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.50) X-Recommended-Action: accept X-Filter-ID: Mvzo4OR0dZXEDF/gcnlw0c2Pj46HODYmpAMVAv0J1pOpSDasLI4SayDByyq9LIhVQR5wYWWYzWlM jAA6KnZtykTNWdUk1Ol2OGx3IfrIJKyP9eGNFz9TW9u+Jt8z2T3Kl1t3PxQdgOVB4KO7stALLbn8 9BIBgtE2IAnMkD8CZKeMvbrcNIp1spSs0AN58sFRW1MQIlbQUA5st77Y3mNjkOKVse1sVhWabI0/ +PN3sILHVVTXf5apOyWcnMnhZLFwebztekbPqbDmNnncjIsWHMEm7tKEpHdXwUhaKwsrPt/ZjvIf 3ZE8NCh0XOqomorHB6mHSb/tl+iz4DGx+nERWM3SJIkHBpFEKn3A4fhH655pXKProzXLPzllmGlS uFNFsBJVicGF0pScaYF0cbsFSai4lLVsHaig8dhzXtBwzjbBwn3RZaDvAeaE0cjjhyXMDhYewl27 eNEocECIeAlHjeZE7YJwhBWCb1PmFojBOyjXs2KsRjKrCowEavDwQuKoqf7t1hKh+Dwyk9YIwySB 2viQiuxMGzDVZhIOOKXk9UMHf3Z428OYCLPzMENQNo3nKTjECb0PwpN4olPuA0AI98GnwaAJEVFc /Yyyh5s5K+hZ05Igigh8/KKouQliHRJ/zpmFH49eS+rG8M0nA+F1PXN9IujNGDkEc+OF3fg2/XR5 Ekt0ci2qDHfezEzGlONF0i+vei6sLBccvg//CWaOWNO6Dwf0Na/RznKPQEVjA26LBDMrD7q/cJog wbqzsuokJ8G05MX47P+LD4CE7zw2V2bh4MY9ZCOIfOJlpMrlrmHPiTzD+4kgpifzlr7oupQOiT/H f5KNOMgXRN6dPqtI2M9Sz5ByPTK86NnOqqIbo2y1gVFxlunRApOjWONHrNR29R/2gMGq0KWAzmMf +ibVDit5QcL8tN6+qD4YqgES8loq3yy99pRApWihpJ4yN9Wh2cGNICj+74tv4Ho29ZIKsMEavzt+ PYIWFngwZuyqjCahzttXT6cT4TBXzjfG6WzX6nWMxCV7fmA8PPBfmPnmQwF0kCbF4TBDiZIXIMeq JGQ= X-Report-Abuse-To: spam@se001.arandomserver.com On 16/12/2019 23:10, Mikael Magnusson wrote: > On 12/16/19, Nick Cross wrote: >> >> Hi, >> >> 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/)" >> >> While I found information about ^(xxx) it wasn't clear how to have >> multiple expressions to ignore. >> >> Am I right in thinking I can add (.) to e.g. *.groovy to ensure I only >> search for files as well ? > > I think what you want is > grep (^(test|target)/)#*.groovy(.) > Thats great thanks! Works perfectly. So to break it down - the ^ negates the or'd block. Can you explain how the wrapped (../) and # then works please? Thanks Nick