Created
October 27, 2023 14:25
-
-
Save pbsds/1076f3e6a389c85e7f6560d8beeca0e6 to your computer and use it in GitHub Desktop.
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
porcelain2jsonl() { | |
uniq | ( | |
printf "[" | |
while read key data; do | |
if test -z "$key"; then | |
printf "]\n[" | |
else | |
printf '{"%s": "%s"}, ' "$key" "$data" | |
fi | |
done | |
echo "]" | |
) | sed -e 's/, ]/]/g' | grep -v '^\[\]$' | jq add -c | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment