jq combine output on a single line separated by space

The usual way would be to use the @csv or @tsv operators to convert the result in the CSV or tab-delimited format. These operators need the result to be contained in an array. For your case also to have a single space delimit, we can do a simple join(" ") operation

jq -r '[.Accounts[].Id]|join(" ")'

Leave a Comment