Printing multiple values on the same line

The easiest way in your example is to use String Interpolation along with the -r option. e.g.

echo '{ "fmep": { "foo": 112, "bar": 234324, "cat": 21343423 } }' | \
jq -r '.fmep| "\(.foo) \(.bar)"'

produces

112 234324

You may also want to consider putting the values in an array and using @tsv e.g.

echo '{ "fmep": { "foo": 112, "bar": 234324, "cat": 21343423 } }' | \
jq -r '.fmep | [.foo, .bar] | @tsv'

which produces tab-separated

112 234324

Leave a Comment

tech