test file:
$ cat file 123{{ namespace.default_ttl }}456
we apply to it a small program in the internal language of the sed program:
$ sed -i 's/{{ namespace.default_ttl }}/\nstanza {\n\tstorage a\n\tengine n\n\tttl c\n}/' file
we get in the file what is required:
$ cat file 123 stanza { storage a engine n ttl c } 456
addition
if the text for the substitution is in a separate file:
$ cat pattern stanza { storage a engine n ttl c }
then it should only be read, for example, by the cat program (using the e modifier from the s command of the sed program, which allows the shell to form the command in the pattern space and replace the pattern space with its output). but if the required substring is “framed” with some other text, then two “approaches” will be required - first, separate the substring from the “framing” text with line breaks:
$ sed -i 's/{{ namespace.default_ttl }}/\n&\n/' file
and then replace the desired substring with the contents of the pattern file:
$ sed -i 's/{{ namespace.default_ttl }}/cat pattern/e' file
\n. maybe backslash will need to double\\n- Mike