Quantcast
Viewing all articles
Browse latest Browse all 524

How to copy from object with out using the table index

The input is

{"zoo": [   { "x": { "guesst": "" } },   { "y": { "guesst": "zebra" } }  ]}

And i need the output like

{"zoo": [   { "x": { "guesst": "zebra" } },   { "y": { "guesst": "zebra" } }  ]}

I did:

jq '.zoo[0].x.guesst = .zoo[1].y.guesst'

But, what if i do not know the order of the objects in the array?


Viewing all articles
Browse latest Browse all 524

Trending Articles