I'm using the find
command in Mac OS X 10.9, I tried commands like this:
$ touch "a gre a"
$ find -E . -iregex ".*\bgre\b.*"
It looks that the find
will not return this file named a gre a
.. Does anyone have ideas about this? Thanks!
find
command's regex engine (ERE) doesn't support \\b
for word boundaries.
On OSX following will work for word boundaries:
find -E . -iregex ".*[[:<:]]gre[[:>:]].*"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.