I have a text file that looks something like this:
Some text here. This text is not replaced.
---
And then a wild block appears!
It has stuff in it that I'm trying to replace.
---
The block is no more. Nothing to replace here.
And another text file with contents to insert:
A multi-
line thing to replace.
This block is not demarcated
in the same way
as the other
And what I'm trying to do is replace the ---
-demarcated block with the contents of the text file, so that it looks like this:
Some text here. This text is not replaced.
A multi-
line thing to replace.
This block is not demarcated
in the same way
as the other
The block is no more. Nothing to replace here.
This is similar to this question, but I don't think that applies, since what I'm dealing with is a multi-line block, and it doesn't seem like sed
is very good at that. Can awk
or ruby
or something do this?