Skip to content

Instantly share code, notes, and snippets.

@tbelaire
Created June 15, 2014 18:37
Show Gist options
  • Save tbelaire/d00cb77fb0db7b38bed2 to your computer and use it in GitHub Desktop.
Save tbelaire/d00cb77fb0db7b38bed2 to your computer and use it in GitHub Desktop.
#!/bin/bash
cat all.json |
# curl 'http://www.khanacademy.org/api/v1/videos/localized/all' |
jq -r '
[
.[] |
{
title,
en_id:.youtube_ids["en"],
errors:
(.youtube_ids
| with_entries(
select (.value | contains("="))
) // {}
)
}
| select( .errors | length > 0 )
| {
title, en_id, errors, error_lang: (.errors | keys[])
}
| { title, en_id, error_lang, error_id : .errors[.error_lang]}
] | sort_by(.error_lang)[] # Note the tailing[], we want values, not an array
# Turn into an array and serialize to csv
| [ .title, .en_id, .error_lang, .error_id ] | @csv
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment