Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 10 down vote accepted

Try either:

ls -l ^*.owp

or:

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
1  
^*.owp did the job. whooa, for what *.(^owp) really does :) – math Mar 22 '12 at 14:19
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.