I've this sed & find command
find /home/www/ -name footer.php -exec sed -i 's/<\/body>/testmoe\n<\/body>/'
what I need to replace testmoe with data in file.txt so its gona be ,
find /home/www/ -name footer.php -exec sed -i 's/<\/body>/file.txt\n<\/body>/'
any suggestion to correct my command
Best Answer
To improve a little on @Iain's answer, I think you can do it in just one pass like this:
This searches for
</body>
, inserts the file into the buffer, appends</body>
to the buffer, and then deletes the original</body>
, which as Iain correctly pointed out can't be moved.