summaryrefslogtreecommitdiff
path: root/bin/mycsv2ledger
blob: b13e1b7f33f0b7411cf0d9f9449f870bdef60be3 (plain)
  1. #!/bin/sh
  2. set -e
  3. infile="$1"
  4. basename=$(basename "$infile" .csv)
  5. outfile="${2:-$basename.ledger}"
  6. rulesfile="$basename.rules"
  7. cat "$basename".*.rules > "$rulesfile"
  8. hledger print --rules-file "$rulesfile" -f "$infile" > "$outfile"
  9. [ "-d" = "$2" ] || rm "$rulesfile"