From owner-freebsd-questions@freebsd.org Fri Jun 21 04:47:40 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D1E015D04E1 for ; Fri, 21 Jun 2019 04:47:40 +0000 (UTC) (envelope-from mail@ozzmosis.com) Received: from blue.elm.relay.mailchannels.net (blue.elm.relay.mailchannels.net [23.83.212.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCCDD7602D for ; Fri, 21 Jun 2019 04:47:38 +0000 (UTC) (envelope-from mail@ozzmosis.com) X-Sender-Id: dreamhost|x-authsender|relay@ozzmosis.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 93D5A5E0793; Fri, 21 Jun 2019 04:10:04 +0000 (UTC) Received: from pdx1-sub0-mail-a9.g.dreamhost.com (100-96-88-48.trex.outbound.svc.cluster.local [100.96.88.48]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E39C75E1C85; Fri, 21 Jun 2019 04:10:03 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|relay@ozzmosis.com Received: from pdx1-sub0-mail-a9.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Fri, 21 Jun 2019 04:10:04 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|relay@ozzmosis.com X-MailChannels-Auth-Id: dreamhost X-Robust-Spot: 01751a1e5a7b583e_1561090204364_2727136410 X-MC-Loop-Signature: 1561090204364:1527519907 X-MC-Ingress-Time: 1561090204364 Received: from pdx1-sub0-mail-a9.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a9.g.dreamhost.com (Postfix) with ESMTP id AF94E8009C; Thu, 20 Jun 2019 21:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=ozzmosis.com; h=date:from :to:cc:subject:message-id:references:mime-version:content-type :in-reply-to; s=ozzmosis.com; bh=dHpPS+nUot9G+Gye/sF6OwR/rfk=; b= pTeMHNWtHqFIFCoPGqHKWLQXRJJHqX4mqWHbRMdjgQjZBhLcxO6CWQpM1mlBtph6 8MdzfljyNdMuOST4T16cZqD8jiJ5fkG+UkRofn2rdv/cF703sQI3CeOuGn7+WoTJ sQOyEosRnNu4csEyaZtusb1oJn1+sx/a10niAxllIkw= Received: from blizzard.ozzmosis.com (167-179-139-56.a7b38b.mel.nbn.aussiebb.net [167.179.139.56]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: relay@ozzmosis.com) by pdx1-sub0-mail-a9.g.dreamhost.com (Postfix) with ESMTPSA id DA38080097; Thu, 20 Jun 2019 21:09:56 -0700 (PDT) Received: by blizzard.ozzmosis.com (Postfix, from userid 1001) id D0B0555DB; Fri, 21 Jun 2019 14:09:53 +1000 (AEST) Date: Fri, 21 Jun 2019 14:09:53 +1000 X-DH-BACKEND: pdx1-sub0-mail-a9 From: andrew clarke To: Polytropon Cc: FreeBSD Questions Subject: Re: How to un-select files in shell wildcard patterns Message-ID: <20190621040953.65nb47tcifow3y2l@ozzmosis.com> References: <20190621054909.c6ba47ab.freebsd@edvax.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190621054909.c6ba47ab.freebsd@edvax.de> User-Agent: NeoMutt/20180716 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrtdehgdektdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvuffkfhggtggujggfsehttdertddtredvnecuhfhrohhmpegrnhgurhgvficutghlrghrkhgvuceomhgrihhlsehoiiiimhhoshhishdrtghomheqnecukfhppeduieejrddujeelrddufeelrdehieenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepsghlihiiiigrrhgurdhoiiiimhhoshhishdrtghomhdpihhnvghtpeduieejrddujeelrddufeelrdehiedprhgvthhurhhnqdhprghthheprghnughrvgifucgtlhgrrhhkvgcuoehmrghilhesohiiiihmohhsihhsrdgtohhmqedpmhgrihhlfhhrohhmpehmrghilhesohiiiihmohhsihhsrdgtohhmpdhnrhgtphhtthhopehfrhgvvggsshguqdhquhgvshhtihhonhhssehfrhgvvggsshgurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-Rspamd-Queue-Id: BCCDD7602D X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ozzmosis.com header.s=ozzmosis.com header.b=pTeMHNWt; spf=pass (mx1.freebsd.org: domain of mail@ozzmosis.com designates 23.83.212.20 as permitted sender) smtp.mailfrom=mail@ozzmosis.com X-Spamd-Result: default: False [-1.53 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[ozzmosis.com:s=ozzmosis.com]; NEURAL_HAM_MEDIUM(-0.72)[-0.723,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:23.83.208.1/20]; NEURAL_HAM_LONG(-0.99)[-0.994,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[ozzmosis.com]; NEURAL_SPAM_SHORT(0.49)[0.486,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[ozzmosis.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[20.212.83.23.list.dnswl.org : 127.0.3.0]; MX_GOOD(-0.01)[mx2.dreamhost.com,mx1.dreamhost.com]; IP_SCORE(0.21)[ipnet: 23.83.208.0/21(0.64), asn: 36483(0.51), country: CA(-0.09)]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:36483, ipnet:23.83.208.0/21, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_SEVEN(0.00)[7] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jun 2019 04:47:40 -0000 On Fri 2019-06-21 05:49:09 UTC+0200, Polytropon (freebsd@edvax.de) wrote: > I'm interested in a convenient method to "un-select" files > when using regular (sh) shell wildcards. It's quite easy to > describe things like > > *.tex > > to perform an operation on all LaTeX source files, or > > *a* > > on all files whose name contains (at least) one "a". Patterns > that are based on the inclusion of certain attributes are not > a problem to deal with using the builtin pattern matching of > the shell. > > But what about the opposite? Let's say, perform an operation > on all files _except_ the LaTeX source files, or all files > whose name does _not_ contain an "a"? > > Is there a good method to do this, except creating a kind > of "custom regex wrapper script" that does the selection part, > for further use with `subshell` or | xargs? zsh can do glob exclusion once "extended globbing" is enabled: $ setopt extendedglob List all files except LaTeX source files: $ ls ^*.tex List all files except those with an 'a' character in the name: $ ls ^*a*