Ubuntu awk转义单引号

Ubuntu awk转义单引号,ubuntu,awk,Ubuntu,Awk,让我们假设如下: head delete.txt{printf(“curl-XPOST”localhost:52000/buildings/\u search?pretty'-H”Content Type:application/json'-d'{\''query'\':{'\''match'\':{'\''building.id'\':'\'\''%s'\''''''''''.}};\n',$1)}' 其中包含一些字符串,双引号已被转义(“),以便打印。单引号呢 错误消息为awk:^unter

让我们假设如下:

head delete.txt{printf(“curl-XPOST”localhost:52000/buildings/\u search?pretty'-H”Content Type:application/json'-d'{\''query'\':{'\''match'\':{'\''building.id'\':'\'\''%s'\''''''''''.}};\n',$1)}'

其中包含一些字符串,双引号已被转义(“),以便打印。单引号呢

错误消息为awk:^unterminated string

单引号呢

我看到它通常被用作变量

awk -v q="'" 'BEGIN {print q "Something" q}' </dev/null

或者类似于
printf
,仅用于格式化。

多么奇怪的命令行。我会使用
xargs printf
head delete.txt | xargs -d '\n' -I {} curl -XPOST 'localhost:52000/buildings/_search?pretty' -H 'Content-Type: application/json' -d '{ "query": { "match": { "building.id" :  "{}" }}'