Date: Fri, 21 Jun 2019 07:48:33 +0200 From: Polytropon <freebsd@edvax.de> To: Robert Huff <roberthuff@rcn.com> Cc: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: How to un-select files in shell wildcard patterns Message-ID: <20190621074833.91788e9c.freebsd@edvax.de> In-Reply-To: <23820.24473.509724.279485@jerusalem.litteratus.org> References: <20190621054909.c6ba47ab.freebsd@edvax.de> <23820.24473.509724.279485@jerusalem.litteratus.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 21 Jun 2019 00:39:53 -0400, Robert Huff wrote: > > Polytropon writes: > > > 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? > > Um ... does > > Polyt> ls -al "*^a*" No, does not. Not in sh, not in csh... ;-) Of course, the simple negation works as expected in tools like awk, for example: "ls | awk '!/a/'", but I thought there would be some convenient way to achieve the same _within_ the shell. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190621074833.91788e9c.freebsd>