This may work for you (GNU sed and Bash):
sed $'153r replacementFile\n;153,156d' file
or for most seds:
sed -e '153r replacementFile' -e '153,156d' file
or if you prefer:
sed '153,156c\ let view:String.UTF8View = string.utf8\ if let from = range.lowerBound.samePosition(in: view),\ let to = range.upperBound.samePosition(in: view) {\ offset.pointee += Int32(string[string.startIndex..<range.lowerBound].utf8.count)\ length.pointee = Int32(view.distance(from: from, to: to))\ return token\ } else {\ return nil\ }' file
NB The first \ saves the leading space and each line, except for the last, which should be added with \ . Markdown in SO is not formatted properly when an empty string is represented by one \ (so I deleted the second replacement string), but most shells should.
source share