On Sunday, March 24, 2024, Oğuz <oguzismailuy...@gmail.com> wrote: > > $ printf '%s\0' "${a[@]@k}" | xargs -0 jq --args -n '$ARGS.positional > | _nwise(2) | {(.[0]): .[1]}' | jq -s add >
On reflection, splitting by NULs in JQ is better; there is no guarantee that xargs will always provide an even number of arguments. -- Oğuz