1

I am creating a build script to sweep through .html files after they are generated, I cannot seem to find out how to get this to work. Here is a snippet:

for PAGE in ${PAGES[@]}
do
    echo "\t\t\t- $DIR_PRE$PAGE.html"
    echo "\t\t\t- cleaning links in $DIR_PRE$PAGE.html"
    php helper.php output lang=$GET+environment=prod+page=$PAGE > $SITE/$DIR_PRE$PAGE.html
    find * -name \*.html -print0 | xargs -0 sed --in-place -e 's~.php~.html~g'
done

the last find command is supposed to find links with the .php extension with in the .html file and replace it with .html but I get this error:

sed: illegal option -- - usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...] - wiiu.html

1 Answer 1

2

If you want to rename all .html files to .php in current directory recursively:

find . -name "*.html" -exec rename .html .php {} \;

Edit: misunderstood the question. You can use sed to replace strings within files:

sed -i 's/.html/.php/g' *.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.