diff --git a/info/come.tsv b/info/come.tsv new file mode 100644 index 0000000..62dc943 --- /dev/null +++ b/info/come.tsv @@ -0,0 +1,6 @@ +Date Type Product Amount Price +2022-8-8 Income Init 1 400 +2022-8-8 Buy Cigs Chapman Green 1 -220 +2022-8-8 Buy Nachos 1 -60 +2022-8-8 Buy Jaguar Green 1 -50 +2022-8-8 Debt Sasha.G 1 500 diff --git a/info/count-all.sh b/info/count-all.sh new file mode 100755 index 0000000..7bbfd30 --- /dev/null +++ b/info/count-all.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +awk="goawk -i tsv" + +echo -n 'Current money: ' ; $awk -f count-current-money.awk come.tsv +echo -n 'Current debt: ' ; $awk -f count-current-debt.awk come.tsv + diff --git a/info/count-current-debt.awk b/info/count-current-debt.awk new file mode 100644 index 0000000..cc6bd45 --- /dev/null +++ b/info/count-current-debt.awk @@ -0,0 +1,3 @@ +BEGIN {cnt = 0} +{if($2 == "Debt") cnt += $4 * $5} +END{print cnt} diff --git a/info/count-current-money.awk b/info/count-current-money.awk new file mode 100644 index 0000000..9153890 --- /dev/null +++ b/info/count-current-money.awk @@ -0,0 +1,3 @@ +BEGIN{cnt = 0} +{cnt += $4 * $5} +END{print cnt}