From owner-freebsd-questions@freebsd.org Fri Jun 21 05:59:12 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 BBB6A15D192E for ; Fri, 21 Jun 2019 05:59:12 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8321081913 for ; Fri, 21 Jun 2019 05:59:11 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.12.231]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPA (Nemesis) id 1MHXWL-1hredg1vYP-00DX7A; Fri, 21 Jun 2019 07:45:57 +0200 Date: Fri, 21 Jun 2019 07:45:57 +0200 From: Polytropon To: andrew clarke Cc: FreeBSD Questions Subject: Re: How to un-select files in shell wildcard patterns Message-Id: <20190621074557.b0f9aca2.freebsd@edvax.de> In-Reply-To: <20190621040953.65nb47tcifow3y2l@ozzmosis.com> References: <20190621054909.c6ba47ab.freebsd@edvax.de> <20190621040953.65nb47tcifow3y2l@ozzmosis.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:Nvva1/VTyk5Z/VYS2CPuEwzSIphgkdZQze936u8Wzqr5zqjsu8b AR0iKjJOdnDLSkYujDVBplL6071oh34PYI4+yTgHjnhFancATA4RyQTxOPTcrCliKSZM3b2 DM2YWKkz37+Md1K69+BvdhRl2uN/ToNN+4+02RswnuBYtzkxchmeRRDBVXvpG7pMsAh6puW KaOOLYmOgVIaGT+pRQtyg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:G4xiF2zF4NM=:IUpf2b3ltqTfkVgaab7hZw zqSwqcCcoYrf8/PmAWxfDBcvIpjLDrbRXUc//AaHjlAwkl7Eo2D5WM3Wcdc4sXCMBsYE7xdfP 6P1s0x2a0vHKPTncaVetM1PWOrOJSVA6mGQvnwmH0jpi2jGoPvkeAlx8krK+lkpxPaWColGpd evgnE8yIEaohb3NdzbL5sVah0pTpkpaVKO5zuf+B7r6We+saGJXWGuRiRgED2v2HkuDk8/VPy td46MdiQUypX/jGac0EORLeAT4+Tmr2FXhA/40019B6bwsd6chfhL7j+DKsVdAUFyqbNhoc3P bHkoyoTDGPmIn23S64S38ViCML83IJKIFXR9oR824ppbcOCz3HOT9h/9s/yDauG8mduFrF09q eN59VeEIKuZB28kqxarGhQl7KPaFqCEbxlkqCw3V0G5EePkpcd6HO1dvgPPbhiUz06qfwJybi rWqs7DjCLvi4Zb9UG6GFOAfjLCsWhKek10ro6Cg9WjMH3+LudA2YTcWpHT0hG/TUG7DRNrZzS jU0bHE/kUpzY1o0El750NMhzFyIJzfSMg22iRwmACIVbp0Ga2Cj/Hf24zBWTODf1/AiZemqzf MddU/IK92Ujua+BhHewaQidEVHga0r8Wc+g35cIb0OT1o6FpZGEVQBzOfx1QQ0q1ILBNq71BS WZpSbDzczDELSiaklFMxnugx7f7xZYg/eg56EbNXOdJr4BTQ0KBUJo/SL1rbi6txV2IhjRjS7 Tvsn4LjR5L+dRA+6Wch10Ak7WNkTcKfszvQexEaTKqBVrE1raqf0mbLvCuQ= X-Rspamd-Queue-Id: 8321081913 X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [4.17 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: mx01.schlund.de]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.68)[-0.685,0]; RECEIVED_SPAMHAUS_PBL(0.00)[231.12.222.94.zen.spamhaus.org : 127.0.0.11]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.96)[0.958,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000,0]; RCVD_IN_DNSWL_NONE(0.00)[187.126.227.212.list.dnswl.org : 127.0.5.0]; MID_CONTAINS_FROM(1.00)[]; R_SPF_NA(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[187.126.227.212.rep.mailspike.net : 127.0.0.17]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(0.51)[ip: (1.45), ipnet: 212.227.0.0/16(-1.41), asn: 8560(2.50), country: DE(-0.01)] 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 05:59:13 -0000 On Fri, 21 Jun 2019 14:09:53 +1000, andrew clarke wrote: > 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* Again, zsh shows its superiority, but the solution should work in regular sh (primarily for portability) and maybe in csh (for convenience). ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...