I need using sed...
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> |
basically you can use other separator than / for a replace expression, say ^ if it's never met in your replace code and linebreaks could be replaced with \n.
|
Why not use the "r" command to read in the data from a file?
See this tutorial: http://www.grymoire.com/Unix/Sed.html ---> Reading in a file with the 'r' command |
What about something like this? Edit a file, put these lines and execute it:
Code:
#!/bin/bash |
All times are GMT -5. The time now is 08:51 AM. |