#!/bin/sh
if  [ $# -lt 1 -o $# -gt 2 ]; then
	echo "usage: "`basename $0`" WKN/ISIN [quiet]"
	exit 1
fi
if [ `pwd` = `echo $HOME` ]; then
	if [ $# = 2 ]; then
		wget -q -O $1.html https://www.ariva.de/$1/kurs
	else 
		wget -O $1.html https://www.ariva.de/$1/kurs
	fi
	lynx -dump $1.html | sed -n -e '/Starts/,/Zusammenfassung/p' | \
	grep -v '|' | grep -v Startseite | grep -v Zusammenfassung | \
	grep -v BUTTON | grep -v Kurse | grep -v [hH]andel | \
	grep -v Sales | grep -v Chart | grep -v News | grep -v Forum | \
	grep -v Symbol | grep -v ersich | grep -v Anleihen | \
	grep -v Push | sed 's/\[[0-9][0-9]\]//g' | grep '.'
	rm $1.html
else
	echo "not in "$HOME 
fi
