#!/bin/sh

CATCH=\
"
SIGNAL IDUNA Krankenversic	Signal Iduna Krankenversicherung
Apple Servi	Apple Services
Baloise Sachversicherung Aktiengesellschaft	Baloise Unfallversicherung
"
cat $1 | sed 's/\(..\)\.\(..\)\.\(....\)/\3-\2-\1/g' | sort | while read -r line
do
    DATE="$(echo "$line" | cut -d";" -f1 | tr -d '"')"
    ENTRY="$(echo "$line" |  cut -d";" -f4 | sed 's/Auftraggeber: //g;s/Buchungstext: //g')"
    AMOUNT="$(echo "$line" |  cut -d";" -f5)"

if [ ! -z "$AMOUNT" ]
then
    echo -e "\n$DATE $ENTRY\n    Expenses:          $AMOUNT EUR" | tr -d '"'
fi



done
