mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-10 14:16:41 +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 "$@"
|