#!/bin/sh
#
#   get_nfbm    (version 1.0)
#
# Usage:  get_nfbm
#
# By:  Angel Corbera, TSID1, Refinery Isla, Curacao, N.A.
# Comments to:  corbera@rocketmail.com
#
# Purpose: Counts FBM types from System Cfg files.
#
echo "Extracting FBM Types from /usr/fox/sp/IIF.pkg ...\c"
grep FBM /usr/fox/sp/IIF.pkg | awk '{print $5}' > tmp1
N=`wc -l tmp1 | awk '{print $1}'`
echo " ... Done!"
#
echo "Building statistics ... \c"
#
TYPES=`sort -u tmp1`
rm FBM.sum > /dev/null 2>&1
echo "\nFBMtype\t= Quantity\t( percent )\n" > FBM.sum
#
for x in $TYPES
do
 NUMBER=`grep $x tmp1 | wc -l` 
 PCT=`expr 100 \* $NUMBER / $N`
 echo "$x \t= $NUMBER \t( $PCT %)" >> FBM.sum
done
#
echo "\nTotal \t=      $N\n" >> FBM.sum
rm tmp1 >/dev/null 2>&1
echo "Done. FBM.sum (statistics) is ready!"
more FBM.sum
1