#!/bin/sh
TDIR=/tmp
SDIR=$HOME/$LOGNAME
FILEx=$HOME/bin/long
FILE1=$HOME/faelligkeitx-`date +%d-%m-%y`.txt
FILE3=$HOME/lynx_bookmarks.html
if [ $# -gt 0 ]; then
	echo "usage: "`basename $0`
	exit 1
fi
#hole.sh $FILE1 tgz
#tar xfz $FILE1
cd $TDIR
for a in `awk '{print $1}' $FILEx`
do
	grep -m 1 -A 1 "Rendite bis" $SDIR/$a.kurs | \
	grep -v Rendite | \
	awk '{ORS=" ";print $1}' > $FILE1
	if [ `grep '.' $FILE1 | wc -w` = 0 ] || \
	[ `grep ',' $FILE1 | wc -w` = 0 ]; then
		echo -n "n.a.perpetual " > $FILE1
	fi
	if  [ `grep -c $a $FILE3` = 1 ]; then
		getname.sh $a >> $FILE1
	fi
	echo -n $a" "
	cat $FILE1
	rm $FILE1
#	rm $SDIR/$a.kurs
done
