Skip to content

Instantly share code, notes, and snippets.

@lincerely
Created January 25, 2023 01:59
Show Gist options
  • Save lincerely/11d712417a793d8a89fa6c80cfc8b157 to your computer and use it in GitHub Desktop.
Save lincerely/11d712417a793d8a89fa6c80cfc8b157 to your computer and use it in GitHub Desktop.
jq query for extracting raw text saved messages from Telegram desktop's exported JSON
#!/usr/bin/env jq -r -f
.chats.list[]
| select(.type == "saved_messages")
| .messages[]
| select(.type == "message" and .text != "")
| [.text_entities[].text] | join("") #combine text
| gsub("\n"; "\\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment