sed: how to add text at the end of the file

Use the $a syntax and sed:

sed -i -e "$a some text" filename

-i parameter means in place.

A previous post explained how to insert a line anywhere but for completeness here it is again:

sed -i -e "2i some text on second line" filename
Please follow and like us:
This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.