Partition Array

Split an array into two groups based on a condition.

Code

General
echo "$arr" | jq '[[.[] | select(. % 2 == 0)], [.[] | select(. % 2 != 0)]]'

Parameters

Array to partition (JSON)

Server

More Bash Snippets