#!/bin/sh # do-doc # ~~~~~~ AUTOmatically create some *.txt files --- Quick & Dirty but NICE ---- # BE CAREFUL to edit !! # Argument: *.dat files # QQ='??' USAGE="do-doc: From (one or several ) file(s) \"meimei.dat\", (\"f2.dat\",...) \n\tproduce 'documentation' file(s) \"meimei.txt\", (\"f2.txt\", ...) \n\n\tEXAMPLES: \n\t\t do-doc meimei.dat \n\t\t m meimei.txt \t\t # Das erzeugte File anschauen \n\t\t \t \t\t # in der Praxis : EDITIEREN \! \n\n\tNOTA BENE: 'Edit' this file, '$PWD/$0' \n\t\t -- to adapt a few standard sentences " ECHO="/usr/5bin/echo" #-- currently works for SunOS 4.1.x AND Solaris 2.x if [ $# -eq 0 -o x$1 = x-h -o x$1 = x-help ] then $ECHO $USAGE ; exit 1 fi ##------------------------------------------------------------------------ ##======================= Die folgenden 2 Linien anpassen ! ================= ## vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Beschr="" Anw="" ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ##=========================================================================== #1 Beschr="NDK-Uebungen 4 aus \"NDK 1992, J.Lindsey, Categorical Data\""s #1 Anw="Kategoriale Daten, Kontingenztafeln, GLM, Generalized Linear Models" files=$@ # echo "Beschreibung: $Beschr" echo "Anw.gebiet: $Anw" dat=`date +'%d.%h %y'` for f in $files do ff=`echo $f | sed 's/\.dat/.txt/'` nlin=`wc -l $f | sed 's/^ *//' | awk '{print $1}'` echo "$ff: Dataset has $nlin Lines" sed "/BESCHREIBUNG :/s//& ${Beschr}/; 1s/:/: `basename $f .dat`/" AA.maske \ | sed "/read.table/s/ *\.dat/$f/" \ | sed "/^ANWENDUNG/s/:/: ${Anw}/" \ | sed "/^DIM/s|:|: ?? / $nlin|" \ | sed "/^DATUM/s|:|: ${dat} / ???|" \ > $ff # Could extract number of cases using 'wc'. ... #cat $ff done