blob: d01ced64dc2f5431ef4ad68400a125264e2f9b25 (
plain)
- #!/bin/sh
- set -e
- infile="$1"
- basename=$(basename "$infile" .csv)
- outfile="${2:-$basename.ledger}"
- rulesfile="$basename.rules"
- {
- find * -name "$infile.rules" -execdir cat '{}' +;
- find * -name "$basename.*.rules" \! -name "$infile.rules" -execdir cat '{}' +;
- } > "$rulesfile"
- hledger print --rules-file "$rulesfile" -f "$infile" > "$outfile"
- rm "$rulesfile"
|