Regex in find command

Petter Adsen petter at synth.no
Tue Aug 4 13:50:40 UTC 2015


On Tue, 4 Aug 2015 15:05:46 +0200
Johnny Rosenberg <gurus.knugum at gmail.com> wrote:

> I tried all the different regextypes mentioned in the man pages, but no
> success:
> 
> emacs (default)
> posix-basic
> posix-awk
> posix-egrep
> posix-extended
> 
> Neither of them understod this:
> find $Path … -some_options -type d -regex ".*[0-9]{4,5}"
> 
> This worked well with several regex types:
> find $Path … -some_options -type d -regex ".*[0-9]{4}"
> 
> And of course, this worked well in all cases:
> find $Path … -some_options -type d -regex ".*[0-9]+"
> 
> Is the {x,y} syntax not supported in find?

"Mastering Regular Expressions" from O'Reilly says that {min,max} is
supported for egrep, but it also says in a footnote "not supported by
all versions of egrep". My copy is old, though.

Petter

-- 
"I'm ionized"
"Are you sure?"
"I'm positive."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20150804/9d970020/attachment.sig>


More information about the ubuntu-users mailing list