Re: sed r option | insert file

"Jim Hill [email protected] [sed-users]" <[email protected]> Sun, 18 Dec 2016 14:32:59 -0800
Newsgroups gmane.editors.sed.user
Message-ID <CAEE75_1d3XioQ=pokZpNo5DCvzEgvyVRSVTMfJ_0CaWr=A-h6A@mail.gmail.com>
Thierry Blanc <[email protected]> wrote:

> I try to insert a textblock saved in a file (file1.txt) into another
> file (file2.txt). File 2 is an rdf file.
>
> file 1 should be inserted into a block and replace the content of the block.

The `/start/,/end/` pattern matches for every line in the range, separately.

Easiest way I know to replace the innards is

    sed '/start/,/end/ { //!d; /end/ r file1.txt; }' file2.txt

if you're sure the end line is in there somewhere.

-- 
Jim