I am trying to write a new json file. I want to define multiple variables then set them with piping to different properties in the new json file.
jq --arg dnb "$DOMAIN_NAME_BUILT" --arg origin "$DOMAIN_ID_BUILT" \
'.Origins.Items[0].DomainName = $dnb' | '.Origins.Items[0].Id = $origin' distconfig.json > "$tmp" && mv "$tmp" distconfig.json
This works with just one variable: --arg NAME VALUE pattern, but when I add in a second arg and use piping jq ... 'x1 = y1 | x2 = y2, e.g.
it breaks.
pipe should be inside the filter. and, consider using assignment operator to shorten your code: