hledger/bin/budget-rewrite.sh
2017-01-08 07:28:23 -08:00

11 lines
585 B
Bash
Executable File

#!/bin/sh
# budget.sh < $LEDGER_FILE
# or hledger print ... | budget.sh
# https://github.com/simonmichael/hledger/issues/99#issuecomment-270796337
hledger-rewrite -f- expenses:food --add-posting '(budget:food) *-1' \
| hledger-rewrite -f- expenses:health --add-posting '(budget:health) *-1' \
| hledger-rewrite -f- expenses:home --add-posting '(budget:home) *-1' \
| hledger-rewrite -f- expenses:transport --add-posting '(budget:transport) *-1' \
| hledger-rewrite -f- 'expenses not:(food|health|home|transport)' --add-posting '(budget:misc) *-1'