Created
March 21, 2018 17:00
-
-
Save stefaneng/99db9882821620d9ba17785fdcac6794 to your computer and use it in GitHub Desktop.
jq - Group by count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo '[{"key": 1}, {"key": 2}, {"key": 1}]' | jq 'group_by (.key)[] | {key: .[0].key, length: length}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment