【发布时间】:2017-09-18 08:18:17
【问题描述】:
我的字符串:
INSERT INTO tb(str) VALUES('So is there really more of you to love now? it\'s ...HB\\');
现在,我必须让它与 SQLite 兼容,所以我必须将单引号替换为 2 个单引号。我试过这个 AWK 脚本,但我只想替换 \' 而不是 \\'。
echo "So is there really more of you to love now? it\'s ...HB\\'" | awk '{ gsub( /\57\047/, "\047\047" ); print; }'
【问题讨论】: