AIに聞いたらreduceでめっちゃゴネゴネ頑張ると出来るよって
jq 'reduce .[] as $x (0; if $x >= 2 then . + $x else . end)' #=> 5
まぁこれは書きたくないわな…
echo '[1,2,3]' | jq 'reduce .[] as $x (0; if $x >= 2 then . + $x else . end)' #=> 5
Please Login to reply.
No replies yet.