# This file is used to breakup the original file into useful information # # File format: # int,cpu% >$1.out stat=0 cpu=0 scpu=0 rec=0 echo "Starting rebuild of $1 into $1.out" while read line do # Get date if [ `echo $line | egrep 'GMT|SAST' | wc -l` -eq 1 ] then int=`echo $line|cut -c12-16` fi # Get vmstat 2 60 data if [ `echo $line | grep "vmstat 2 60" | wc -l` -eq 1 ] then stat=1 fi # If stat=1 - entered into stat data if [ $stat -eq 1 ] && [ `echo $line | egrep 'vmstat|procs|avm|END' | wc -l` -eq 0 ] then scpu=`echo $line | awk '{ print $16 "+" $17 }'|bc` cpu=`expr $cpu + $scpu` fi # END of data string if [ `echo $line | grep END | wc -l` -eq 1 ] then cpu=`expr $cpu / 60` # Write data line echo "$int,$cpu" >>$1.out stat=0 int=0 cpu=0 scpu=0 rec=`expr $rec + 1` echo "`date`:Wrote record: $rec" fi done < $1 echo "Complete!"