Skip to content

Instantly share code, notes, and snippets.

@rollxx
Last active September 26, 2018 11:25
Show Gist options
  • Save rollxx/7e246834d139f6ef5bd2027326a29647 to your computer and use it in GitHub Desktop.
Save rollxx/7e246834d139f6ef5bd2027326a29647 to your computer and use it in GitHub Desktop.
iterate over json files
#!/usr/bin/env bash
for tenant in $(seq 1 12); do
input=sitemap-${tenant}.json
for i in $(seq 0 $(expr $(jq length ${input}) - 1 )); do
jq ".[$i]" -r ${input} > sitemap-${tenant}-${i}.json
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment