Created
May 24, 2018 12:38
-
-
Save jonahx/db9cf8f79b635795052ac4246a5e6e56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check1 - print total deposits and checks | |
/~check/ { ck = 1; next } | |
/~deposit/ { dep = 1; next } | |
/~amount/ { amt = $2; next } | |
/~$/ { addup() } | |
END { | |
addup() | |
printf("deposits $%.2f, checks $%.2f'n", deposits, checks) | |
} | |
function addup() { | |
if (ck) | |
checks += amt | |
else if (dep) | |
deposits += amt | |
ck = dep = amt = 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment