Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 9 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
    
For anyone who can't get this to work, you need to set the extendedglob option in Zsh. –  NewWorld May 31 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.