How can I use jq
to transform this array of arrays:
[
[
"sequence",
"int"
],
[
"time",
"string"
],
...
]
Into an array that contains the first (0) element from every subarray? Meaning to produce output like this:
[
"sequence",
"time",
...
]
I was thinking to use reduce xx as $item (...)
but I didnt manage to come up with anything useful.
You can use map
filter this way:
jq 'map(.[0])'
Another option would be jq '[.[][0]]'
this gives the same result as using map(.[0])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With