Say I have file A, in middle of which have a tag string “#INSERT_HERE#”. I want to put the whole content of file B to that position of file A. I tried using pipe to concatenate those contents, but I wonder if there is more advanced one-line script to handle it.
Share
Use sed’s r command:
$ cat foo one two #INSERT_HERE# three four $ cat bar foo bar bar foo $ sed '/#INSERT_HERE#/{ r bar > d > }' foo one two foo bar bar foo three four