Skip to content

Instantly share code, notes, and snippets.

@gsgoncalves
Created November 27, 2018 18:27
Show Gist options
  • Save gsgoncalves/9cb25667a3fc548f94227a5dc159534a to your computer and use it in GitHub Desktop.
Save gsgoncalves/9cb25667a3fc548f94227a5dc159534a to your computer and use it in GitHub Desktop.
JQ WaPo examples
# Count the number of content elements in a WaPo json line object - Debug mode
jq '{id: .id, items: [.contents[] | select(.type == "pull_quote")]} | select(.items | length > 0) | length' TREC_Washington_Post_collection.v2.jl | wc -l
# More compact
jq '[.contents[] | select(.type == "tweet")] | length > 0' TREC_Washington_Post_collection.v2.jl | grep true | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment