#!/bin/sh
#
# som_read
#
# Usage:   som_read  inputfile
# where:  inputfile is any "som"/"rsom" output file (or log)
#
# Purpose:  This script will process a log file that has been
# receiving the output of "rsom" utility.  It will get the
# highest values on each Screen page.  At the end it will
# produce a table, that can read very quicly.
#
# By: Angel Corbera, TSID1, Refinery Isla, Curacao
# Comments to:   corbera@rocketmail.com
#

sed -e '/^.$/d' $1 > tmp1
sed -e '/Trace/d' tmp1 > tmp2
sed -e '/^\*/d' tmp2 > tmp1
sed -e '/OM /d' tmp1 > tmp2
sed -e '/ID/d' tmp2 > tmp1
sed -e '/Entry/d' tmp1 > tmp2
sed -e '/Conn.Table/d' tmp2 > tmp1
awk ' { if ( $1 == "Screen" ) 
		print $0
        else
		{ if ( $1 ~ /[0-9][0-9]/ ) print $1 }
}' tmp1 > tmp2
awk '  BEGIN { val = 0 }
   { if ( $1 == "Screen" )
	  if ( $0 ~ /00/ ) 
			{printf "\n"
	                val = 0 }
	  else
	                  {printf "\t%0s", val
	                   val = 0}
else
	if ( $1 > val )  
		 val = $1
      }' tmp2 > tmp1
more tmp1
