hey, does anyone how I could go about using the find utility using a regular expression. <br /><br />I tried something like this and I have no idea why it doesn't work..I know I'm doing something wrong. <br /><br />I'm trying to find only certain file extensions with this.<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->find . -iregex ".+\.(html|php)" -print<!--c2--></div><!--ec2--><br /><br />I could always use something like this, but as the file extensions increase, it could be quite inefficient. <br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->find . \( -name *.html -o -name *.php \) -print<!--c2--></div><!--ec2--><!--content-->
Hi Section31 the question I have is are you just trying to find all files with the extensions html and php <br />OR <br />are you planning on doing more with the command after you find the specified files ?<!--content-->
you can try this <br />find . -iregex '.*\.\(htm\|php\)' <br /><br />That should find all php and htm files<!--content-->
<!--QuoteBegin-rmulhern+Dec 4 2004, 11:52 PM--><div class='quotetop'>QUOTE(rmulhern @ Dec 4 2004, 11:52 PM)</div><div class='quotemain'><!--QuoteEBegin-->you can try this <br />find . -iregex '.*\.\(htm\|php\)'Â <br /><br />That should find all php and htm files<!--QuoteEnd--></div><!--QuoteEEnd--><br />oh geez...thank you so much... that worked...<br /><br />You could've just said escape all metacharacters except . or * you know <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid="" border="0" alt="tongue.gif" /><!--content-->
Hi Section31 the question I have is are you just trying to find all files with the extensions html and php <br />OR <br />are you planning on doing more with the command after you find the specified files ?<!--content-->
you can try this <br />find . -iregex '.*\.\(htm\|php\)' <br /><br />That should find all php and htm files<!--content-->
<!--QuoteBegin-rmulhern+Dec 4 2004, 11:52 PM--><div class='quotetop'>QUOTE(rmulhern @ Dec 4 2004, 11:52 PM)</div><div class='quotemain'><!--QuoteEBegin-->you can try this <br />find . -iregex '.*\.\(htm\|php\)'Â <br /><br />That should find all php and htm files<!--QuoteEnd--></div><!--QuoteEEnd--><br />oh geez...thank you so much... that worked...<br /><br />You could've just said escape all metacharacters except . or * you know <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid="" border="0" alt="tongue.gif" /><!--content-->