#!/bin/sh if [ -z "$1" -o -z "$2" ]; then echo "usage: $0 " exit fi trgfile=$1 ; srcfile=$2 # general topic=`grep '#\ T' $srcfile | awk -F^ '{ print $2 }'` desc=`grep '#\ D' $srcfile | awk -F^ '{ print $2 }'` author=`grep '#\ A' $srcfile | awk -F^ '{ print $2 }'` email=`grep '#\ M' $srcfile | awk -F^ '{ print $2 }'` event=`grep '#\ E' $srcfile | awk -F^ '{ print $2 }'` location=`grep '#\ L' $srcfile | awk -F^ '{ print $2 }'` xwidth=`grep '#\ X' $srcfile | awk -F^ '{ print $2 }'` ywidth=`grep '#\ Y' $srcfile | awk -F^ '{ print $2 }'` # information needed to parse contents total=`grep '^[0-9]' $srcfile | tail -1 | awk '{ print $1 }'` echo "found $total chapters ..." ((count = 0)) # print normal header cat > $trgfile << EOF
$topic
$desc
$author email: $email event: $event location: $location
EOF # contents overview page cat >> $trgfile << EOF
Inhalt
EOF while [ "1" ]; do ((j = 0)) ((count += 1)) cat >> $trgfile << EOF `grep ^${count} $srcfile | awk '{ print $0 }'` EOF grep ^\ ${count}\.[0-9] $srcfile | awk '{ print ""$0"" }' >> $trgfile cat >> $trgfile << EOF EOF [ "$count" = "$total" ] && break done cat >> $trgfile << EOF
EOF # the conetent # to be continued ... ;) ((count = 0)) while [ "1" ]; do ((j = 0)) ((count += 1)) echo "creating content chapter $count ..." cat >> $trgfile << EOF
`grep ^${count} $srcfile`
EOF total_j=`grep ^\ ${count}.[0-9] $srcfile | tail -1 | awk '{ print $1 }' | awk -F . '{ print $2 }'` echo " - ${total_j} chapters below" ((count_j = 0)) #while [ "1" ]; do # cat # temporal devel break, stonefly will have a look at this script now! :) cat >> $trgfile << EOF
EOF [ "$count" = "$total" ] && break done cat >> $trgfile << EOF
EOF echo "done ..."