aqbanking2ledger

#!/bin/sh
# read aqbanking data on standard input, write ledger data on standard output
IFS=';'
tr -d '"'|while read transactionId localBankCode localAccountNumber remoteBankCode remoteAccountNamber date valutadate value_value value_currency localName remoteName remoteName1 purpose purpose1 purpose2 purpose3 purpose4 purpose5 purpose6 purpose7 purpose8 purpose9 purpose10 purpose11 category category1 category2 category3 category4 category5 category6 category7
do printf '%s\t* %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\t; %s\n\t\tExpenses\n\t\tAssets:DeutscheBank\t%s%s\n\n' "$date" "${remoteName:-???}" "$purpose" "$purpose2" "$purpose3" "$purpose4" "$purpose5" "$purpose6" "$purpose7" "$purpose8" "$purpose9" "$purpose10" "$value_value" "$value_currency"
done|sed '/^\t\t; $/d'