Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to list all files but those ending with owp: Hence I tried:

  ls -l *.(^owp)
  zsh: unknown sort specifier
  ls -l *(^owp) 
  zsh: unknown sort specifier
  ls -l *[^o][^w][^p] # does not work either, missing some files

none worked. How do I that in a correct manner? My .zshrc has "set extendedglob".

share|improve this question
up vote 11 down vote accepted

Try either:

ls -l ^*.owp


ls -l *~*.owp

Appended () in glob patterns are for glob qualifiers, while you want a glob operator.

What *.(^owp) does is:

  1. Match all file names ending with a dot
  2. if they aren't pipes (^p), and
  3. sort the matches (o) by "w" => "unknown sort specifier"

See man zshexpn => FILENAME GENERATION for more on this.

share|improve this answer
^*.owp did the job. whooa, for what *.(^owp) really does :) – math Mar 22 '12 at 14:19
For anyone who can't get this to work, you need to set the extendedglob option in Zsh. – SpaghettiCat May 31 '14 at 13:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .