【发布时间】:2020-12-27 16:07:34
【问题描述】:
假设如下:
head delete.txt | awk '{printf("curl -XPOST 'localhost:52000/buildings/_search?pretty' -H 'Content-Type: application/json' -d' { '\'"query'\'": { '\'"match'\'": { '\'"building.id'\'" : '\'"%s'\'"} } } '; \n", $1);}'
其中包含一些字符串,并且双引号已转义(“)以便打印。单引号呢?
错误信息是 awk: ^ unterminated string
【问题讨论】:
-
多么奇怪的命令行。我会使用
xargs printf。