#!/bin/sh # # get_cmpd # # Usage: get_cmpd # # By: Angel Corbera, TSID1, Refinery Isla, Curacao, N.A. # Comments to: corbera@rocketmail.com # # Purpose: Create a COMPOUND Names database (CMPD.csa) from # CSA files residing on CSA host. # Database format: # CP - CMPD # # Some statistics (CMPD.sum) are provided at the end. # # cd /opt/ac mv CMPD.csa CMPD.csa.old > /dev/null 2>&1 touch CMPD.csa CPS=`sort /etc/cplns` echo "\nThis program takes about 3 minutes ... or less." for x in $CPS do echo "Retrieving data from CSA files for $x ..." /usr/fox/csa/csa_save $x | awk ' $2 == "" ' > z awk '{a="'$x'"}{printf "%-8s %-13s\n",a,$1}' z >> CMPD.csa done echo " --> CMPD.csa database is ready." #rm z # echo "Building Statistics ... \c" rm CMPD.sum > /dev/null 2>&1 touch CMPD.sum TOT=`wc -l CMPD.csa|awk '{print $1}'` echo "Plant statistics for: `date`" >> CMPD.sum echo "Total cmpnds = $TOT" >> CMPD.sum echo "==============================================" >> CMPD.sum echo "... \c" # awk '{print $1}' CMPD.csa > tmp1 for x in $CPS do NUMBER=`grep $x tmp1 | wc -l` PCT=`expr 100 \* $NUMBER / $TOT` echo "$x cmpnds = $NUMBER \t( $PCT %)" >> CMPD.sum done echo "==============================================" >> CMPD.sum # rm tmp1 tmp2 echo "Done. CMPD.sum (statistics) is ready!" echo "\n Press SPACE for next page. "q" to QUIT\n" more CMPD.sum CMPD.csa