在unix中删除/替换并发双引号

时间:2014-06-10 10:55:31

标签: unix

如何替代重复的双引号? 例如,下面的行

"I need help with ""Unix"" scripting"

需要更改为

"I need help with 'Unix' scripting"

即代替""用'

1 个答案:

答案 0 :(得分:0)

使用sed

$ var='"I need help with ""Unix"" scripting"'
$ echo $var
"I need help with ""Unix"" scripting"
$ echo $var | sed 's/""/'"'"'/g'
"I need help with 'Unix' scripting"