Skip to content

Instantly share code, notes, and snippets.

@galvanic
Created June 20, 2016 10:30
Show Gist options
  • Select an option

  • Save galvanic/098cc8246d1aab3aaeae9f5c260818fe to your computer and use it in GitHub Desktop.

Select an option

Save galvanic/098cc8246d1aab3aaeae9f5c260818fe to your computer and use it in GitHub Desktop.
command line to get a simple toc (without hyperlinks) for ipython notebook(s) using jq
cat *.ipynb | jq '.cells' | jq -c '.[] | select(.cell_type | contains("markdown"))' | jq -c '. | select(.source[] | contains("#")) | .source[]' | grep "#" | sed 's/"//g' | sed 's/\\n//g' | sed 's/#/\t/g' | sed 's/\(.*\)\t/\1-/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment