: #set -x ALMHIST=/usr/hstorian/almhist # # Find out if we are running on Venix, SunOS or Solaris (SVR4) # to use awk or nawk or correct path for bpatch. # if [ -f /vrtx ] then echo " -=- Venix OS -=-" BPATCH=/usr/foxbin/bpatch AWK=/usr/bin/awk TMPFILE=/usr/tmp/almhist.tmp TXTFILE=/usr/tmp/almhist.txt else if test -f /etc/fox/ia_opsys \ && test `awk '{print $1}' /etc/fox/ia_opsys` = 1 then echo " -=- 51 Series OS -=-" BPATCH=/usr/fox/disp_tools/bpatch AWK=/usr/bin/nawk TMPFILE=/opt/fox/almhist.tmp TXTFILE=/opt/fox/almhist.txt else echo " -=- 50 Series OS -=-" BPATCH=/usr/fox/disp_tools/bpatch AWK=/usr/bin/awk TMPFILE=/opt/fox/almhist.tmp TXTFILE=/opt/fox/almhist.txt fi fi rm -f $TMPFILE rm -f $TXTFILE $BPATCH -d $ALMHIST > $TMPFILE $AWK 'BEGIN { print " ALARM HISTORY\n" print "COMPOUND:BLOCK.POINT..................BLOCK-DESCRIPTOR...............PRI ALARM" print "MM-DD HH:MM:SS vvvvvvvvv uuuuuu (vvvvvvvvv)OPTIONAL-MESSAGE...................\n" line = 1 } { if( FILENAME == "/usr/pub/ascii" ) { i=1; if( length($1) != 1 ) continue; while( i 10 ) { for( i=2; i<=17; i++ ) { printf "%s", ascii[$i] if( ( i == 10 ) && (line % 5) == 0 && (line %10) != 0 ) { printf " " } } if( ((line % 5) == 0 ) && ((line % 10) != 0) ) { printf "\n" } if( (line % 10) == 0 ) { printf "\n" } } line++ continue } } }' /usr/pub/ascii $TMPFILE >$TXTFILE rm -f $TMPFILE # # since this is a circular buffer - find out where to begin. # awk ' BEGIN { oldest_str = "20-50 25:61:61" } { for(i=1;itemp linenum=`cat temp` #echo $linenum awk '{ printf "%d\n", $1 - 1 }' temp > temp2 endline=`cat temp2` #echo $endline rm -f temp rm -f temp2 sed -n 1,5\p $TXTFILE >$TMPFILE sed -n $linenum,\$p $TXTFILE >>$TMPFILE sed -n 6,$endline\p $TXTFILE >>$TMPFILE cp $TMPFILE $TXTFILE rm -f $TMPFILE