File size: 535 Bytes
093b0a5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/bin/bash
# This script removes all output from a Jupyter notebook
# Generated using copilot
# Usage: source clean_ipynb.sh notebook.ipynb
# Check if the file exists
if [ ! -f $1 ]; then
echo "File $1 does not exist"
exit 1
fi
# Check if the file is a Jupyter notebook
if [ "${1: -6}" != ".ipynb" ]; then
echo "File $1 is not a Jupyter notebook"
exit 1
fi
# Remove all output from the notebook
python -m nbconvert --clear-output --inplace $1
# jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace $1
|