sed工作中使用

使用变量

var1=QQ
sed -i 's/$var1/ZZ/g' $file

不能实现任务,因为在单引号中,都是文本,使用双引号就可以了

sed -i "s/$var1/ZZ/g" "$file"
发布了135 篇原创文章 · 获赞 7 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/math_computer/article/details/103666261
今日推荐