sed weirdness, unmatched {

r /file/path must not have anything after it on its line.

You may find this site helpful as a Command Summary for sed

echo 'one
two
five
six
seven
three
four' >inputfile

echo 'contents of readfile' >readfile

sed  '/two/{r readfile
         d}' inputfile

Note: You can utilize the shell to parameterize sed, by using "double quotes". They enable shell variable expansion. r takes all spaces literally... so don't quote the filename, and don't have any trailing whitespace (whitespace between r and /file/path is ok).

rfile='/tmp/readfile with   multiple spaces in name'
sed  "/two/{r $rfile
       d}" inputfile

output

one
contents of readfile
five
six
seven
three
four

On a side note: There is really no value using < for your input file. Use sed's input file parameter (it keeps things simpler).


Break it with multiple '-e' flags, one for each line

% sed -e '/two/{ r /tmp/data2' -e 'd}' <  /tmp/data