Skip to content

Instantly share code, notes, and snippets.

@begnini
Created October 30, 2022 19:40
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 begnini/30d0ee5250c810796001d8b5c608e526 to your computer and use it in GitHub Desktop.
Save begnini/30d0ee5250c810796001d8b5c608e526 to your computer and use it in GitHub Desktop.
#!/bin/bash
URL_DATA="https://resultados.tse.jus.br/oficial/ele2022/545/dados-simplificados/br/br-c0001-e000545-r.json"
data=$(wget -q -O - $URL_DATA)
echo $data | jq -r '
[50*"="],
[" ELEICOES 2022 - 2 turno"],
[50*"="],
(["% apurado", .pst, "atualizado", .hg]),
[50*"-"],
[" %", "Candidato"],
(.cand[] |
[.pvap, (.nm | (. + (" " * (20 - length)))), (.pvap | split(",")[0] | tonumber*"=")]
) | @tsv'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment