Skip to content

Instantly share code, notes, and snippets.

@pbsds
Created October 27, 2023 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbsds/1076f3e6a389c85e7f6560d8beeca0e6 to your computer and use it in GitHub Desktop.
Save pbsds/1076f3e6a389c85e7f6560d8beeca0e6 to your computer and use it in GitHub Desktop.
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