reg_values.awk 519 B

1234567891011121314151617181920212223242526
  1. # BSD 3-Clause 2023 by Kevin Bloom.
  2. {
  3. split($0, arr, "<<>>")
  4. print arr[1]
  5. total = 0
  6. split("", entry)
  7. for(i in arr) {
  8. if(i > 1) {
  9. raw = arr[i]
  10. split(arr[i], entries, " ")
  11. sub("\\$", "", entries[2])
  12. entry[entries[1]] += entries[2]
  13. }
  14. }
  15. for(i in entry) {
  16. total += entry[i]
  17. # ignore issues with floating point error
  18. if(total * -1 < 0.01 && total * -1 > 0) {
  19. total = 0
  20. }
  21. if(i != "")
  22. printf(" %s %.2f %.2f\n", i, entry[i], total)
  23. }
  24. }