Supprimer les propriétés JSON en place avec JQ
#!/bin/bash
if [ $# -lt 2 ]; then
echo "This script requires jq to be installed."
echo "It will delete the specified property (i.e., key and value) in the JSON file."
echo "Two arguments required: key, and json file to modify, e.g."
echo ""
echo "jdel Modality jq_test.json"
echo ""
echo "======================="
exit 1
else
key=$1
file=$2
jq 'del(."'"$key"'")' $file > tmp.$$.json && mv tmp.$$.json $file
fi
Troubled Tapir