Skip to content

Instantly share code, notes, and snippets.

@simonw
Created June 22, 2019 19:26
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 simonw/0d5c3c0c066a6ae932e7c5936159750f to your computer and use it in GitHub Desktop.
Save simonw/0d5c3c0c066a6ae932e7c5936159750f to your computer and use it in GitHub Desktop.
I have this in ~/bin/catjq - chmod 755 - from https://news.ycombinator.com/item?id=20246957
#!/usr/local/bin/jq -rf
tostream
| select(length > 1)
| (
.[0] | map(
if type == "number"
then "[" + tostring + "]"
else "." + .
end
) | join("")
) + " = " + (.[1] | @json)
# https://news.ycombinator.com/item?id=20246957
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment