0

I'd like to find the PDF files whose name (excluding the extension) is greater than three.

$ find ~  -iregex '.*/[^/]{3,}.pdf'

when test with

$ find ~ -regextype posix-extended -iregex '.*/[^/]{3,}.pdf'
find: -regextype: unknown primary or operator

How can I enable the {3,} variant?

1
  • If this is GNU find, add the -regextype posix-egrep option. According to the info documentation, the default regex type is emacs. I assume you can install GNU find with homebrew. May 11 '18 at 13:27
2

How about find ~ -name '???*.pdf' ?

0

You need the -E option with find or escape the curly brackets.

find -E ~ -iregex '.*/[^/]{3,}\.pdf'

find ~ -iregex '.*/[^/]\{3,\}\.pdf'

then escape the period .

You must log in to answer this question.

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