0

Lets assume the following:

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);}'

where the contains some strings and the double quotes have been escaped (") in order to be printed. What about the single quotes .

error message is awk: ^ unterminated string

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93

1 Answers1

0

What about the single quotes .

I saw typically it's used as a variable.

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

But in your case, I would drop awk and if you meant to execute the curl:

head delete.txt | xargs -d '\n' -I {} curl -XPOST 'localhost:52000/buildings/_search?pretty' -H 'Content-Type: application/json' -d '{ "query": { "match": { "building.id" :  "{}" }}'

or similar with printf when only for formatting.

KamilCuk
  • 120,984
  • 8
  • 59
  • 111