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=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 6b6937f4 for ; Mon, 16 Dec 2019 23:10:49 +0000 (UTC) Received: (qmail 4466 invoked by alias); 16 Dec 2019 23:10:43 -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: 24558 Received: (qmail 29618 invoked by uid 1010); 16 Dec 2019 23:10:43 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f53.google.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(209.85.166.53):SA:0(-2.0/5.0):. Processed in 0.801423 secs); 16 Dec 2019 23:10:43 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.53 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=9QUgVmRYcZPeMDbLDfqa6EOVdQpsBlyX8wXSIk7sB38=; b=JJtTXqDRqljAJKOUyFREtGjSmxqnKTyA7/CyikmhS+8BkJxtTsA9+cDnlh/65hcHtt nyZKNqlSFgrIriK0Ybs2jQ/OUcpykQiFDp61HIw499M+jB6iEnBE0ZRQ9nHjBRv7IOfC h+IVIFeQwilLvOVXDa/h7GMLT+/sWulpo26f0z0k4MYooJ6/3MfAoZXOzL2d2MvBIbPd cp9tpDuaA8u/Xke11/JLlKcIXrywosQtqTfP2iRfVgZeRW9l7i2HD1xbNiQJj4IiyXJK lwWu9wG4Q0nhSg4YVMCtI5E9R3vbsNs+Vpw+08qAH25WBsNmSDresbRp8kykW1ShAHiu /9zg== X-Gm-Message-State: APjAAAWBcHyJr4ba/TT2SF/iy7QGHqPySYOYbTyaeiPvo1ULEPtM7+92 RMFTu8Sx5In7Z0xxcV4y5cMiJfDpLT9kFYNsr+Zd+VJ7 X-Google-Smtp-Source: APXvYqxMqwaliz4PhHKqsE5P08FJMAhaWwXp/7ZTYjZOk9CZtxujsZqAMcvOc7IE4JLo7IhW06ea621wSu3yX80m/Gg= X-Received: by 2002:a5d:939a:: with SMTP id c26mr1352569iol.3.1576537808944; Mon, 16 Dec 2019 15:10:08 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <15c62c86-5b55-e248-725f-4ecbfe73822d@goots.org> References: <15c62c86-5b55-e248-725f-4ecbfe73822d@goots.org> From: Mikael Magnusson Date: Tue, 17 Dec 2019 00:10:08 +0100 Message-ID: Subject: Re: Glob and grep To: Nick Cross Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" 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(.) -- Mikael Magnusson