Lets say I have fileA
, with the contents
Hello, this is some
random text REPLACEHERE and some more
random text
and fileB
with the contents
stuff that goes into
fileA, at that specific place
How do I properly replace REPLACEHERE
inside fileA
, with the contents of fileB
? Exactly in that place, just as if I was doing a simple regex operation ?
The closest I've got was
sed -i '/REPLACEHERE/r fileB' fileA
which only ends up appending fileB in the line after REPLACEHERE
was found, and that's no good. I need it to be replaced exactly in place (I thought that's what the i
flag was for actually).