Created
November 17, 2021 22:21
-
-
Save timtomch/b4fc0ad514c9689bf537c82686a0d2d3 to your computer and use it in GitHub Desktop.
Count DPLA objects by rights status
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
def counter(stream): | |
reduce stream as $s ({}; .[$s|tostring] += 1); | |
counter(.[] | select(."_source".sourceResource.type) | select(."_source".sourceResource.type[] | test("^image|physical object")) | ."_source".rights) |
Other tools considered:
- gron: Make JSON work with grep
- Dadroit JSON viewer - works well with large(ish) files
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Call as
jq -s -f rightscounter.jq <inputfile(s)>
Works with multiple input files as well, count will be collated across files. Doesn't work well with too many large files, causes script to crash.
References: