3

对,所以在 Bash 脚本中,我有以下行:

sed -i 's/$/,"123456","789101112","0001",'"$THEDATE"',"DDX"/' /tmp/tmp02.csv

但是,每当我运行它时,我总是会收到错误

sed: -e expression #1, char 42: unknown option to `s'

我认为这是变量位,但是无论我这样做,它似乎都不会逃脱双引号..任何帮助都非常感谢!

4

1 回答 1

4

我认为你有斜线THEDATE,它们被 sed 混淆为正则表达式分隔符。尝试更改替换分隔符,例如!

sed -i 's!$!,"123456","789101112","0001",'"$THEDATE"',"DDX"!' /tmp/tmp02.csv
于 2013-07-18T08:42:11.467 回答