Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: list all except



Eric Smith wrote:
> What is the zsh way to select all files except 
> those matching a regex?

(You mean globbing pattern, not regular expression, right?)

Use ^pat, which excludes everything matching pat, or pat1~pat2, which
selects based on pat1, then excludes based on pat2.  These require
extendedglob.  For example,

setopt extendedglob
print -l ^*.o

You can also "setopt kshglob" and use the ksh forms that bash now
understands.  These tend to be clumsier.

See the list of "Glob Operators" in the zshexpn manual page.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author