mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-27 12:24:43 +03:00
16 lines
348 B
Bash
Executable File
16 lines
348 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# This scripts expects stdin formatted like this:
|
|
# <multi-line csv file>
|
|
# RULES
|
|
# <multi-line rules>
|
|
#
|
|
awk -vCSV="t.$$.csv" -vRULES="t.$$.csv.rules" '
|
|
BEGIN{output=CSV}
|
|
/^RULES/{output=RULES}
|
|
!/^RULES/{print $0 >output}'
|
|
|
|
trap "rm -f t.$$.csv t.$$.csv.rules" EXIT ERR
|
|
|
|
hledger -f csv:t.$$.csv --rules-file t.$$.csv.rules print "$@"
|