Array Frequencies

Count how many times each value appears in an array and return a frequency map.

Code

General
echo "$arr" | jq 'group_by(.) | map({(.[0]): length}) | add'

Parameters

Array to count (JSON)

Server

More Bash Snippets