[ILUG] find regex question

Stephen Shirley diamond at skynet.ie
Tue Jun 18 17:13:46 IST 2002


On Tue, Jun 18, 2002 at 04:41:23PM +0100, Justin MacCarthy wrote:
> find /  -iregex
> '^[a-z0-9]\{8\}\-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{12\}\.*
> $'

Right, 3 things. First, from the man page:

       -regex pattern
              File name matches regular expression pattern.  This
              is a match on the whole path, not  a  search.   For
              example,  to match a file named `./fubar3', you can
              use the regular expression  `.*bar.'  or  `.*b.*3',
              but not `b.*r3'.

so the ^ at the start has to change to ^[^\/]*\/
Secondly, you've got a typo there; ^[a-z0-9]\{8\}\-. The - shouldn't be escaped.
Thridly, i don't think find accepts the pattern{n} method, or at least, not
that i can see.

Steve
-- 
"Oh look, it's the Pigeon of Love."




More information about the ILUG mailing list