Skip to content

Instantly share code, notes, and snippets.

@gitjeff05
Last active March 16, 2020 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitjeff05/6dd641ce5a80a049d9800185ee88c6c5 to your computer and use it in GitHub Desktop.
Save gitjeff05/6dd641ce5a80a049d9800185ee88c6c5 to your computer and use it in GitHub Desktop.
Remove cell outputs and execution_count with the addition/merge operator in jq
local FILE
FILE=${1}
jq -r --indent 1 '. + { "cells": .cells
| map(. +
(if .cell_type == "code" then { "outputs": [], "execution_count": null } else {} end)
) }' "${FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment