【发布时间】:2017-04-09 23:09:44
【问题描述】:
我正在用 awk 编写一个脚本,用双引号替换文件夹中所有文件的所有双引号。
我在 stackoverflow 中找到了这个,但我得到了其他结果
awk 'BEGIN{FS=OFS="#"} {for (i=0;i<=NF;i++) gsub(/"/, "&&",$i)} 1 $f3 > $f2
本示例的输出:
01##"hello world"98##
是
01##""""hello world""""98##
我想得到
01##""hello world""98##
【问题讨论】:
-
您的输入文件是什么样的?
$f3内容? -
您好,感谢您的回复 01##"hello world"98##
-
如果你对
sedsed 's/"/&&/g' inputfile没问题
标签: linux bash awk substring gsub