diff options
Diffstat (limited to 'process_hsbc_transactions.sh')
-rwxr-xr-x | process_hsbc_transactions.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/process_hsbc_transactions.sh b/process_hsbc_transactions.sh index 0b37204..63cecb4 100755 --- a/process_hsbc_transactions.sh +++ b/process_hsbc_transactions.sh @@ -16,22 +16,22 @@ else "Cannot find $tf. Expecting it either in ~/Downloads or in current folder." fi # remove the BOM (https://stackoverflow.com/questions/45240387/how-can-i-remove-the-bom-from-a-utf-8-file) -sed -i $'1s/^\uFEFF//' $tpath +sed -i $'1s/^\uFEFF//' "$tpath" # read the file and process lines -while read line; do +while read -r line; do line=${line//"-"/"£"} - echo -e "$line\n$(cat $tmpfile)" > $tmpfile -done < $tpath + echo -e "$line\n$(cat "$tmpfile")" > "$tmpfile" +done < "$tpath" # how to append to a text file in bash -echo -e "Date,Description,Amount\n$(cat $tmpfile)" > $tmpfile +echo -e "Date,Description,Amount\n$(cat "$tmpfile")" > "$tmpfile" # use ledger to convert to ledger format -$(ledger convert --input-date-format "%d/%m/%Y" $tmpfile > $ledgertmp) +ledger convert --input-date-format "%d/%m/%Y" "$tmpfile" > "$ledgertmp" # Remove the erroneous Equity lines -sed -i '/Equity:Unknown/d' $ledgertmp +sed -i '/Equity:Unknown/d' "$ledgertmp" # dump to sdout for further redirection -cat $ledgertmp +cat "$ledgertmp" |