Last active
March 23, 2023 15:43
-
-
Save jmakeig/6eb3df63002a3f26505ff8ff1f29f309 to your computer and use it in GitHub Desktop.
Split a file containing a JSON Array into one file per item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Splits a file that contains a top-level JSON Array | |
# into individual files, one per item, named sequentially | |
# https://stedolan.github.io/jq/download/ | |
jq -c .[] "$1" | awk '{print > (NR ".json")}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment