Skip to content

Instantly share code, notes, and snippets.

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 mymindwentblvnk/0d43b1c4bc00fea3bd5308e28ba64fc7 to your computer and use it in GitHub Desktop.
Save mymindwentblvnk/0d43b1c4bc00fea3bd5308e28ba64fc7 to your computer and use it in GitHub Desktop.
Go over all files in a GCS bucket and find files, that are not valid JSON.
for file in $(gsutil -m ls -r gs://**/*.json); do
echo "Validating $file"
gsutil cat "$file" | jq > /dev/null
if [ $? -ne 0 ]; then
echo "Invalid: $file" > invalid_files.txt
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment