Linux / Windows – what’s the difference…

Snippet for replacing certain code within PHP code

Replaces/searches by row on unix commandline:

find folder/* -type f -name \*.php -exec sed -i.bak.php "s/function_name('blahblah');/\$variable['blahblah'];/" {} \;

– searches in certain folder
– searches in .php files
– makes backup of modified files
NB! Some things must be escaped with \ mark

Leave a Reply

Your email address will not be published. Required fields are marked *