Appending after a pattern from a file in sed

Tagged sed, linux, bash  Languages bash

Useful when you want to append the contents of a whole file into something you are sed'ing. Be careful if you use -i, it will replace the working file.

sed -i "/attr_accessor :config/r ../patch_for_application.rb.tmpl" app/controllers/application.rb