crtxdmp.

A collection of ideas, snippets and other things.


Split json file into multiple ones by key

jq -cr 'keys[] as $k | "\($k)\n\(.[$k])"' input.json |
  while read -r key ; do
    read -r item
    printf "%s\n" "$item" > "/tmp/$key.json"
  done

, , — Apr 11, 2022