commit f340d5080e38e4c7cdc9561dfffc086690f3c73d
parent 2e587d68681c9855a13ff7da81f725c00df3e4b4
author: nathanael <nathanael@dalliard.ch>
date: Sun, 19 Oct 2025 13:12:44 +0000
s0: impr bin tx
diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/s0/dotfiles/bin/tx b/s0/dotfiles/bin/tx
@@ -3,7 +3,7 @@
txfile="$HOME/prv/txs"
print_tx(){
- cat "$txfile" | awk -v var="$1" -v var2="$2" -v var3="$3" -F ',' '
+ awk -v var="$1" -v var2="$2" -v var3="$3" -F ',' '
$2 ~ var && tolower($0) ~ var2 && tolower($0) ~ var3{
total += $2
printf "%s\t%s\t%12.2f\t%12s\t%s\n", NR, $1, $2, $3, $4
@@ -15,12 +15,11 @@ print_tx(){
exit 1
}
}
- '
+ ' < "$txfile"
}
case "$1" in
e|expenses) print_tx "^-" "$2";;
r|revenue) print_tx "^[0-9]" "$2";;
- s|show) sed "$2q;d" "$txfile";;
*) print_tx "^" "$1" "$2" | tail -100;;
esac