I know this has been answered several times, but I can't figure out how to use it for my project.
I have several php files and want to add a new string between line 11 and 12. this is the string I want to add
exec('/var/www/scripte/autostandby.sh > /dev/null 2>/dev/null &');
I guess this is the way to go (for a single file,for multiple I will use *.php instead of file):
sed '12i\ exec('/var/www/scripte/autostandby.sh > /dev/null 2>/dev/null &'); ' file.php
what I get:
 29234 bash: $');\n': command not found
so I guess bash just runs the exec command or something.
how do I add a "long" string containing spaces and stuff like ; ) , ' which seems to mess up the command?
p.s.: adding " " or ' ' doesn't trick the pony.
I also need to "append" something in line 11 from this:
exec('/var/www/streams/taketv.sh > /dev/null 2>/dev/null &');
If possible for all .php files. It's always line 11; the only thing that changes is "taketv.sh" to "abc.sh" or anything like that.
It is the first occasion that " '); " are shown in this combination, so I tried it with something like this (only for 1 file as a test):
sed -i "s/');/ > /dev/null 2>/dev/null &');" TakeTV.php
I guess I need to use what mikeserv said. I tried but it didn't work.
sed -i 's\ '\'');/'\''/'\'' > /dev/null 2>/dev/null &');'\''
My plan was to set the "old word" and "new word" as a closed quote, guess I didn't apply it right!