Jump to content

Recommended Posts

Posted

hey, does anyone how I could go about using the find utility using a regular expression.

 

I tried something like this and I have no idea why it doesn't work..I know I'm doing something wrong.

 

I'm trying to find only certain file extensions with this.

>find . -iregex ".+\.(html|php)" -print

 

I could always use something like this, but as the file extensions increase, it could be quite inefficient.

>find . \( -name *.html -o -name *.php \) -print

Posted
you can try this

find . -iregex '.*\.\(htm\|php\)' 

 

That should find all php and htm files

oh geez...thank you so much... that worked...

 

You could've just said escape all metacharacters except . or * you know :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...