Bash 使用sed在文件中的指定字符串后插入文件内容

Bash 使用sed在文件中的指定字符串后插入文件内容,bash,sed,Bash,Sed,我有以下文件: 蒙戈 和sed命令: sed -i "/'connections' => \[/a \ "$(cat mongo)" \\" /app/config/database.php 因此,我想在字符串后面插入mongo文件的内容: 'connections' => [ 搜索正常,sed找到了字符串,但没有正确获取文件mongo的内容 我得到以下错误: sed: can't read 'mongodb': No such file or directory sed: ca

我有以下文件:

蒙戈

和sed命令:

sed -i "/'connections' => \[/a \ "$(cat mongo)" \\" /app/config/database.php
因此,我想在字符串后面插入
mongo
文件的内容:

'connections' => [
搜索正常,sed找到了字符串,但没有正确获取文件
mongo
的内容

我得到以下错误:

sed: can't read 'mongodb': No such file or directory
sed: can't read =>: No such file or directory
sed: can't read [: No such file or directory
sed: can't read 'driver': No such file or directory
sed: can't read =>: No such file or directory
sed: can't read 'mongodb',: No such file or directory
sed: can't read 'host': No such file or directory
这可能适用于您(GNU-sed):


连接
地址后读入mongoFile。

这看起来像是php的
var\u dump()
的输出。对吧?有点像。。。是一个带有配置的数组,我想将其插入配置php文件中。
sed: can't read 'mongodb': No such file or directory
sed: can't read =>: No such file or directory
sed: can't read [: No such file or directory
sed: can't read 'driver': No such file or directory
sed: can't read =>: No such file or directory
sed: can't read 'mongodb',: No such file or directory
sed: can't read 'host': No such file or directory
 sed -i '/'\''connections'\'' => \[/r mongoFile' file