问题1插入:查找模式并更换整条生产线和寻找模式和后
模式:
test_$(whoami)
变量:
var1=$(pwd)
我想找到的模式,用var1
代替整行
sed -i "s/.*test_$(whoami).*/$var1/" test.txt
它给我的sed:-e表达式#1,焦炭28:未知的选项为'S'
问题2.
模式:
#####Insert here#####
内容是插入:包括$ VAR1 /file_$(whoami).txt
我想找到与模式(完全匹配)就行了,之后插入内容一行
sed -i "s/#####Insert here#####/include $var1/file_$(whoami).txt" test.txt
也不管用
有人可以帮忙吗?