,如果我有文件SOME_FILE命名,与内容如下:猛砸,sed的:具有多文件内容替换模式
first line
second line
third line
和内部脚本:
VAR1="first line\nsecond line\nthird line"
VAR2="`cat some_file`"
我希望VAR1和VAR2是相同,但它显然不是这样根据sed:
sed "s/^a/${VAR1}/" some_another_file # this is OK
sed "s/^a/${VAR2}/" some_another_file # this fail with syntactic error
我想,换行表示我有点不同,但我找不到如何让VAR2等于VAR1。
在此先感谢
@ user665920:在编辑器中,然后按CTRL + K – Erik 2011-03-18 11:34:31
请提交UNIX和GNU/Linux的选择代码/命令[unix.stackexchange.com](http://unix.stackexchange.com/)上相关的问题 – ierax 2011-03-18 11:37:42