This was addressed briefly here: Removing a string in a PHP file with Start and End but I'm looking for a solution to the same code. The first line of every PHP file on the server begins with
<?php if(!isset($GLOBALS[
and ends with -1; ?>
. and in the middle is a long string of code that varies from file to file.
I'm trying to come up with a script to remove this line from all files. I'm running into the same wall as the guy in the previous post.
Using:
sed -e '1 s/^<\?php if(!isset($GLOBALS\[.*-1; \?>//' *.php
in a UNIX environment prints the PHP file without the code, but does not save it. What am I missing?