section31 Posted December 4, 2004 Posted December 4, 2004 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 Quote
TCH-RobertM Posted December 5, 2004 Posted December 5, 2004 Hi Section31 the question I have is are you just trying to find all files with the extensions html and php OR are you planning on doing more with the command after you find the specified files ? Quote
TCH-RobertM Posted December 5, 2004 Posted December 5, 2004 you can try this find . -iregex '.*\.\(htm\|php\)' That should find all php and htm files Quote
section31 Posted December 5, 2004 Author Posted December 5, 2004 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.