Skip to content

Instantly share code, notes, and snippets.

@mrngm
Created July 8, 2016 13:59
Show Gist options
  • Save mrngm/d878aec4d4e162a325163e60d846666e to your computer and use it in GitHub Desktop.
Save mrngm/d878aec4d4e162a325163e60d846666e to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Date,Payee,Category,Memo,Outflow,Inflow"
while IFS='' read -r line; do
line=`echo "$line" | sed -e 's/\r//g'| tr -d \"`
DATE=`echo "$line" | cut -d ';' -f 1 | tr - /`
#DATE=`echo "$line" | cut -d ';' -f 1`
PAYEE="OV-Chipkaart"
#CATEGORY
AMOUNT=`echo "$line" | cut -d ';' -f 6 | tr , .`
TYPETRX=`echo "$line" | cut -d ';' -f 8`
FROM=`echo "$line" | cut -d ';' -f 3`
DEST=`echo "$line" | cut -d ';' -f 5`
MEMO=`echo "$line" | cut -d ';' -f 9`
REIS="$FROM - $DEST / $MEMO"
#echo ${DATE},${PAYEE},,\"${TYPETRX} / ${MEMO}\",${OUTFLOW},${INFLOW}
# assuming only negative transactions
echo ${DATE},${PAYEE},,\"${REIS}\",${AMOUNT},
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment