Commits

juster committed 5f42248

Do not print balances of empty account.

Comments (0)

Files changed (1)

 }
 
 END {
-    for(act in bal) if(len < length(act)) len = length(act)
-    for(act in bal) {
+    for(act in bal){
+        if(bal[act] == 0) delete bal[act]
+        else if(len < length(act)) len = length(act)
+    }
+    for(act in bal){
         amt = sprintf("%0.2f", bal[act])
         printf("%-" len "s %8s\n", act, amt) | "sort"
     }
 
 function adjbals(act, adj)
 {
-    while(1) {
+    while(1){
         bal[act] += adj
         if(!sub(/:[^:]+$/, "", act)) break
     }