#!/bin/bash echo "calendars:" for r in vorne mitte hinten do echo " $r:" echo " id: \"$r\"" echo " ignore: true" echo " schedule:" echo -n " " ( echo '[' prefix_comma='' for d in Mo Di Mi Do Fr do echo -n "$prefix_comma" prefix_comma=', ' cat ../../data/calendar.yaml | yq -cj '.calendar.'"$r.$d"' | . as $dict | [keys[] | . as $key | $dict[$key] | to_entries | [ .[], {key: "day", value: "'"$d"'"}, {key: "start", value: $key}, {key: "age", value: ""}, {key: "extern", value: false}, {key: "duration", value: (($dict[$key].slots) * 15)} ] | from_entries | del(.slots)]' done echo ']' ) | jq -cj '[ .[][] ]' echo done