tags:

views:

99

answers:

4

i have several php files, and there's references to .html files in those.

I need to replace ".html" to ".php"

how can i do this in bash ?

A: 

Try sed:

find -name "filenamepattern.php" -print0 | xargs -0 sed 's/\.html/\.php/g'
Codism
The forum is eating slash. Just add one for each period.
Codism
+2  A: 
for file in $(find . -name "*.php"); do
    sed "s/\.html/.php/g" $file > $$ && mv $$ $file
done
R Samuel Klatchko
`sed --in-place`
Roger Pate
+1  A: 
find -name '*.php' -exec sed -ie 's:.html:.php:g' {} \;
eduffy
A: 

GNU find

find /path -type f -iname '*.php' -exec sed -i.bak 's/\.html/\.php/g' {} +;
ghostdog74