【发布时间】:2021-03-15 01:53:05
【问题描述】:
$ VAR="this is working well"
$ sed -i "s/$/,$VAR/" my.txt
$ VAR="this/got/error"
$ sed -i "s/$/,$VAR/" my.txt
sed: -e expression #1, char 12: unknown option to `s
我必须将各种类型的字符串放入 $VAR。
有时 $VAR 不能与 sed 一起使用。 Bcoz 的特殊字符。
如何使用 sed 或正则表达式解决这个问题?
提前谢谢你。
【问题讨论】: