jq: print only specific keys and values in order jq: print only specific keys and values in order unix unix

jq: print only specific keys and values in order


With your input, the filter

( {c}, {a} )| to_entries[]| "\(.key) \(.value)"

produces the desired output (you will probably want to use the -r command-line option).

If the ordering of keys you want is specified by an array,$a, then you could write:

. as $in| $a[]| "\(.) \($in[.])"

Etc.