I need to basically add some code to like 50 php files. It's basically a script that I want to add near the end of these 50 php files. I figured I could use sed to replace </body> with the code. However the code, is very long and has a bunch of newlines obviously. How would I be able to do this?
sed -e 's/<//body>/(all the text)/' *.php
Since it has newlines, I don't know how to paste it in cause it would take me to a '>' prompt without allowing me to complete the sed command.
Gonna try manually putting in the newlines.
I want to insert this code.
Code:
<br><br>
<center>
<form action="test.php" method=post>
<textarea name="comments" cols=40 rows=6></textarea>
<p>
<input type="submit" value="post comment">
</form>
</center>
<br><br>
<?php
$file = fopen("test","r");
while(! feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
?>
</body>
</html>
Seems like the chars '<>/' would be escape characters. Do I just add a '\' in front of each one?