#!/bin/sh
if [ $# != 1 ]; then
	echo "usage: "`basename $0`" faelligkeit/termin"
	exit 1
fi
case $1 in
faelligkeit | termin )
	$1.sh > $1.tmp
	;;
* )
	echo "usage: "`basename $0`" faelligkeit/termin"
	exit 1
	;; 
esac
awk -F"." '{ORS=" "; for (i=1;i<=NF;i++) print $i; ORS="\n";print ""}' \
$1.tmp | awk '{ORS=" ";print $3,$2,$4,$1; for (i=5;i<=NF;i++) print $i; \
ORS="\n";print ""}' | sort | awk '{ORS=" ";OFS="";print $4,"\t",$2,".",\
$1,".",$3," "; for (i=5;i<=NF;i++) print $i;ORS="\n";print ""}' | \
sed 's/,/./' | sed 's/perpetual/ perpetual/'
rm $1.tmp
