UNIX "find" command, match literal "dot"
Posted
by
Robottinosino
on Super User
See other posts from Super User
or by Robottinosino
Published on 2012-06-24T14:43:22Z
Indexed on
2012/06/25
9:18 UTC
Read the original article
Hit count: 264
I need files ending with ".pdf" or ".png"; here's my attempt:
find /Users/robottinosino/Desktop/_PublishMe_ -type f -regex '.*[pdf|png]'
this incorrectly includes files ending with "Apdf", "Zpdf", etc. (missing literal dot before file extension)
I tried adjusting the pattern to:
find /Users/robottinosino/Desktop/_PublishMe_ -type f -regex '.*\.[pdf|png]'
but then no results are returned. Escaping the . with a backslash does not work. Why?
[0] $ uname -a
Darwin Robottinosino.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
Thanks!
© Super User or respective owner