in reply to modify file in place in script? Regex for changing includes from SSI to PHP
One more, direct on command line. Use caution with these. Use them on a test copy if you can. They can cause accidents that can be hard to undo or end up snowballing with the smallest mistake.
# as one line find . -regex '.*\.html$' -exec perl -pi.bk -e 's{<!--#include virtual +="/ssi/([^"]+)"-->} {<?php\ninclude(\$_SERVER['DOCUMENT_ROOT'].'/ssi/ +\1.txt');\n?>}g' {} \;
|
|---|