annotate bin/budget.sh @ 709:c24a1b531b7e
move isrunning to a shell script and kill killbyname since there is pkill nowadays
author |
Jeff Hammel <k0scist@gmail.com> |
date |
Fri, 05 Sep 2014 14:55:11 -0700 |
parents |
25e92f9cf011 |
children |
|
rev |
line source |
492
|
1 #!/bin/bash
|
|
2
|
|
3 # from http://c2.com/doc/expense/
|
|
4
|
|
5 exec awk ' $1 ~ /^[A-Z]+[A-Z0-9]*$/ { if (sums[$1] == "" || $1 == "SUM") { sums[$1] = sum # Define Symbol $1 = sum sum = 0 } else { $1 = sums[$1] # Dereference Symbol } } ($1+0) != 0 {$1 = sprintf("%7.2f", $1)} # Pretty Print {print} $2 == "*" {$1 *= $3} # Explicit Calculations $2 == "/" {$1 /= $3} $2 == "DB" {$1 = -$1} $2 == "CR" {$1 = -$1} NF == 0 {sum = 0} # Implicit Summation {sum += $1} ' $1 |