Last active
June 4, 2020 08:04
-
-
Save kvnsmth/397456b0da9e3c12a7be61efabe434af to your computer and use it in GitHub Desktop.
JQ recipes to use with Roam Export JSON
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
########################################################################## | |
## 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