Addition on the command line

How much did our household spend on power last year? I wish I had an app that would parse all my bank statements and tell me what it costs just to stay alive, but my bank doesn’t do integrations well. In fact, given that my power company sunset their consumer API, things seem to be even less connected.

So I downloaded a year’s worth of withdrawals in CSV format, and did this:

egrep -i "powerco|gasco" account.csv | awk -F "," '{s+=$4} END {printf "%.0f\n", s}'

I could write the whole thing in awk, but these things evolve by tacking commands onto the pipelines, and there’s no need to get clever.

We spent more than I’d expected to, so my next job is to find out what is chewing up so much energy. Of course, normal people would use a spreadsheet.

DevOps New Zealand