Skip to content

Instantly share code, notes, and snippets.

@kvnsmth
Last active June 4, 2020 08:04
Show Gist options
  • Save kvnsmth/397456b0da9e3c12a7be61efabe434af to your computer and use it in GitHub Desktop.
Save kvnsmth/397456b0da9e3c12a7be61efabe434af to your computer and use it in GitHub Desktop.
JQ recipes to use with Roam Export JSON
##########################################################################
## List Page Titles
##########################################################################
# list in same order as export
jq ".[].title" export.json
# sort by title
jq "sort_by(.title) | .[].title" export.json
# sort by create time asc
jq "sort_by(\".create-time\") | .[].title" export.json
# sort by create time desc
jq "sort_by(\".create-time\") | reverse | .[].title" export.json
##########################################################################
## Filtering
##########################################################################
# Filter to only blocks containing a specified page reference
jq 'recurse | arrays | map(select(.string | strings | test("\\\[\\\[Roam\\\]\\\]"))) | select(. | length | . != 0) | .[] | {string, uid}' export.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment