I am extracting keys from a json with this format:
[
{
"k1":{"k2":4},
"k3":{"k2":6}
}
]
[
{
"k1":{"k2":4},
"k3":{"k2":6}
}
]
I am using this command ["a","b"], (.[] | [.k1.k2,.k3.k2]) | @csv to extract two keys and adding two headers (a, b) to the csv. But The output to this is a header in every other line:
"\"a\",\"b\""
"4,6"
"\"a\",\"b\""
"4,6"
You can see this in this jq play. How can I change to filter to just put header on the first line?