I got something like awk. It looks ugly, but did the trick in its test:
Team:
cat test.txt | awk ' /pattern/ { line = $0; while ((getline < "insert.txt") > 0) {print}; print line; next } {print}'
test.txt:
$ cat test.txt some stuff pattern some other stuff
insert.txt:
$ cat insert.txt this is inserted file this is inserted file
exit:
some stuff this is inserted file this is inserted file pattern some other stuff
bcelary
source share