SED: insert text after the last line?
The simplest way is:
sed -i -e '$aTEXTTOEND' filename
How it works
$
matches the last line (it's a normal sed
address; 4aTEXTTOEND
would insert after the fourth line), a
is the append command, and TEXTTOEND
is what to append, filename
is the file where the TEXTTOEND
will be inserted
No need to use sed
in that case. How about
echo "<?php" >> file
Assuming you want to put the ending php tag to the files, then
sed -i '$s/$/\n?>/' file
should do the trick