You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following filter produces the results you want given the input you provided:
. as $in
| reduce range(1; length+1) as $i
([]; . + [ {name: $in[$i-1].name, "dep_name": $in[$i].name }] )
This particular filter ignores dep_id and so may not be exactly what you need, but rest assured, it can be done in jq.
Since the "Issues" section is primarily for bug reports and enhancement requests, in future, please post usage questions at stackoverflow.com using the jq tag:
I have file like this:
It contains simple dependency chain. Now, I'm trying to get rid of identifiers and transform this file to something like this:
My first idea is to use
foreach
function, but there is something I don't understand (or it won't work).Here is my starting point, output as expected:
Next, print dependencies:
Output is empty. Why?
Let's use some constant id:
Well, no. It should be as below, because the same item is (seems to be) selected four times:
Obviously, I'm missing something. The longer I read the docs, the more I'm confused.
Is this solvable with
jq
?The text was updated successfully, but these errors were encountered: