Append text to file using sed

Geofferey picture Geofferey · Mar 10, 2014 · Viewed 43.6k times · Source

How can I write text to a file using sed? More specifically I would it add null variables to my blank text file that was created using touch. The syntax of sed is very confusing to me.

Answer

user4896506 picture user4896506 · May 13, 2015

Use $ a.

sed -i "$ a some text" somefile.txt