#!/usr/bin/sh # script to generate overview files from the log files that summarize the # monthly readings, taken at midnight of the 1st of each month. The # summary files contains a line for each full reading month and unit #root=/home/chris/construction/BTUmetering # the root directory gets set by the configure script root=MAINPROGROOT logdir=$root/log sumdir=$root/log progdir=$root/scripts summaryfile=$sumdir/summaryfile #definition of all log root file names logroot=("AHU1" "AHU2" "AHU3" "AHU4" "AHU5" "AHU6" "PCW2" "S14L3") # generate a summary file out of all previous data rm -f $summaryfile for ((i=0 ; $i< ${#logroot[*]} ; i++)) do uname=${logroot[$i]} f1="$logdir/heat_$uname.log" $progdir/convert_log_to_monthly.awk -v unitname=$uname $f1 >>$summaryfile done # remove comments in parts of the data grep -v "#" $summaryfile >$summaryfile.2 mv $summaryfile.2 $summaryfile