I want to find a specific file that doesn't start with a,k,G or Q and in which the third letter in the name is not a digit.

I have tried many links, but found nothing regarding to this composite problem.

  • 4
    find . -name '[^akGQ]?[^0-9]*' – jimmij Mar 11 '15 at 23:24
  • 1
    The third letter, by definition is a letter, so not a digit. Did you mean the third character instead? – Stéphane Chazelas Oct 27 '15 at 15:27

Assuming you mean third character as opposed to third letter;

find . -name '[!akGQ]?[!0-9]*'
|improve this answer|||||

In ksh you will have the negation file globbing pattern !( ... ). So you could write

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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