help - how do i run a multi-line sed command in perl?
hey everyone,
I'm writing a little perl script that is editing all my .php files and inserting a google-analytics piece of code before the </body> tag. the sed command works just find from command line, and is such : Code:
sed '/<\/body>/ i\ I have tried putting it in backticks over multiple lines just as is, that doesn't work. i've take out all the spaces and the '\' and made it a single, really long one line command and it doesn't work. I'm at a loss, if anyone can show me what to do it would be really appreciated... this is the last little bit of the script, so any help is greatly appreciated! |
you don't have to execute that piece of sed code in Perl. You can do what that sed does with Perl as well.. either s/// or find the index where </body> lies and add text after it.
|
ah, very cool.
i'll go look at the s///. ya i was going to avoid parsing the script in perl and adding the text because i already had a quick little sed command. thanks, i'll check out s///. much appreciated. |
All times are GMT -5. The time now is 08:59 AM. |