From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21193 invoked from network); 4 Oct 2005 16:15:00 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Oct 2005 16:15:00 -0000 Received: (qmail 97065 invoked from network); 4 Oct 2005 16:14:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Oct 2005 16:14:53 -0000 Received: (qmail 23208 invoked by alias); 4 Oct 2005 16:14:45 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9470 Received: (qmail 23198 invoked from network); 4 Oct 2005 16:14:44 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Oct 2005 16:14:44 -0000 Received: (qmail 95915 invoked from network); 4 Oct 2005 16:14:44 -0000 Received: from cluster-d.mailcontrol.com (HELO rly34d.srv.mailcontrol.com) (217.69.20.190) by a.mx.sunsite.dk with SMTP; 4 Oct 2005 16:14:43 -0000 Received: from exchange03.csr.com (mailhost1.csr.com [81.105.217.43]) by rly34d.srv.mailcontrol.com (MailControl) with ESMTP id j94GEetm027300; Tue, 4 Oct 2005 17:14:40 +0100 Received: from news01 ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 4 Oct 2005 17:16:37 +0100 Date: Tue, 4 Oct 2005 17:14:38 +0100 From: Peter Stephenson To: zzapper Cc: zsh-users@sunsite.dk Subject: Re: Excluding files & directories from a glob Message-Id: <20051004171438.4165d915.pws@csr.com> In-Reply-To: References: Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Oct 2005 16:16:37.0667 (UTC) FILETIME=[FF13E730:01C5C8FE] X-Scanned-By: MailControl A-05-40-00 (www.mailcontrol.com) on 10.68.0.144 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 zzapper wrote: > The following works just fine > > # grep all coldfusion files except ctpigeon.cfm and env.cfm > > grep -i 'host' **/(*.cfm~(ctpigeonbot|env).cfm) > > But I would like it to also ignore sub-directories named junk* With extendedglob, the following should work: grep -i 'host' **/(*.cfm~(ctpigeonbot|env).cfm)~*((#s)|/)junk*/*(.) This excludes any pattern which {either starts with junk or contains /junk} and {contains a / somewhere after the junk}. Clearly that would only apply if somewhere in the path there was a subdirectory starting "junk". I tacked the next bit on at the end just to show the difference, but it's possibly easier to combine the ~ expressions at the end. However, you would need to do the *((#s)|/)(ctpigeonbot|env).cfm trick to make sure that the name only matched a full directory entry, either in the current directory or a subdirectory. You probably don't need the (.) on the end; it just wanted to be there. Actually, most of my directories contain junk, so I won't be doing that... -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 69207 This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com