finding php, html, htm files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting finding php, html, htm files
# 1  
Old 08-03-2011
finding php, html, htm files

how can i limit the output to only php, html, htm files?

i found this as one way

Code:
find . -regex ".*\(php\|html\|htm\)$" -type f -print0 | xargs -0 grep 'keyword'

and it works but is a bit slow
is there any faster way?

i tried something like this but it doesnt work:
Code:
find ./ -iname "*.php" -or -iname "*.html"

how can i do an "or" for -name *.php
or -name *.htm
or -name *.html?

Last edited by methyl; 08-03-2011 at 05:57 PM..
# 2  
Old 08-03-2011
crude attempt.. patterns not bounded by end of line.. but may work for you.

Code:
find /some/path  \( -name "*.php" -o -name "*.html" -o -name "*.htm" \)


Last edited by methyl; 08-03-2011 at 05:57 PM.. Reason: Code tags
# 3  
Old 08-03-2011
Yeaboem's solution is correct and efficient. I might add "-type f" if you are not interested in directory names.

Code:
find /some/path -type f \( -name "*.php" -o -name "*.html" -o -name "*.htm" \)

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search replace hostname in htm files

Need assistance in changing the hostname I have multiple html files in a directory , its src is pointing to houston.sp.com and it needs to change to alaska.sp.com . Below is the example Trying to use perl to change it . Need suggestiong <img border="0"... (3 Replies)
Discussion started by: ajayram_arya
3 Replies

2. Shell Programming and Scripting

Downloading processed HTML of PHP page

Hi, I am trying to obtain the HTML code of a PHP page (http:// areferee .com/soccer/test1.php?quiz=50&ran=1&t=5) after the page has been processed; I want pure HTML. Is there a Unix command I can use to do this? I have tried wget, GET, curl but I am getting odd behaviour i.e. it is not... (9 Replies)
Discussion started by: djcas
9 Replies

3. Shell Programming and Scripting

Finding files with wc -l results = 1 then moving the files to another folder

Hi guys can you please help me with a script to find files with one row/1 line of content then move the file to another directory my script below runs but nothing happens to the files....Alternatively Ca I get a script to find the *.csv files with "wc -1" results = 1 then create a list of those... (5 Replies)
Discussion started by: Dj Moi
5 Replies

4. UNIX for Advanced & Expert Users

If condition and htm not working

checkSync() { CONNECT_STRING=TLDB61/TLDB61@TL10G SQLPLUS_SETTINGS="SET PAGESIZE 0 LINESIZE 1500 ECHO OFF TRIMS ON TAB OFF FEEDBACK OFF HEADING OFF" SQL_RESULT_SYNC_PMCM=`sqlplus -s ${CONNECT_STRING} << EOF ${SQLPLUS_SETTINGS} (SELECT... (2 Replies)
Discussion started by: madfox
2 Replies

5. Shell Programming and Scripting

PHP: Sorting HTML table

Hi All, I have an html table which looks like this: <table align="center" border="1"> <CAPTION><EM>Heading for Table</EM></CAPTION> <tr><td><b>1</b></TD><TD><b>2</b></TD><TD><b>3</b></TD><TD><b>4</b></TD><TD><b>TOTAL</b></TD><TD><b>DATE</b></td></tr> <tr><td>88088283</TD> <TD>87613101</TD>... (1 Reply)
Discussion started by: pondlife
1 Replies

6. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies
Login or Register to Ask a Question