ledge.awk 413 B

123456789101112131415161718192021222324252627282930
  1. # BSD 3-Clause 2023 by Kevin Bloom.
  2. BEGIN {
  3. i = 0
  4. }
  5. /aledger error/ {
  6. print $0
  7. exit 1
  8. }
  9. $1 ~ ":" {
  10. chh = ""
  11. sub("\\$", "", $2)
  12. split($1, accs, ":")
  13. for(k = 1; k <= length(accs); k++) {
  14. if(chh != "")
  15. chh = chh ":" accs[k]
  16. else
  17. chh = accs[k]
  18. if(test[chh] == "")
  19. test[chh] = $2
  20. else
  21. test[chh] += $2
  22. }
  23. }
  24. END {
  25. for(k in test) {
  26. print k " " test[k]
  27. }
  28. }