#!/bin/ksh

#INCLUI os diretorios de scripts e de saida

Eta_ucl=${Eta_home1}/eta/${Conf}/ucl

typeset -R8 west1 west2 east north south res

west1=`head -1 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1 | cut -c14-21` 
#echo $west1
west2=`head -2 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1 | cut -c14-21` 
#echo $west2
east=`head -3 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1 | cut -c14-21` 
#echo $east
north=`head -4 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1 | cut -c14-21` 
#echo $north
south=`head -5 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1 | cut -c14-21` 
#echo $south
res=`head -6 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1 | cut -c14-21` 
#echo $res

echo `head -7 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1` > temp
read  dummy imout1 < temp
echo `head -8 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1` > temp
read  dummy jmout1 < temp
echo `head -9 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1` > temp
read  dummy imout2 < temp
echo `head -10 ${Eta_home1}/eta/${Conf}/scripts/corners.out | tail -1` > temp
read  dummy jmout2 < temp
rm -rf temp

#echo $imout1
#echo $jmout1

cat ${Eta_ucl}/CTLTEMPLATE_temp | sed "s:ptx:$imout1:g" |  sed "s:pty:$jmout1:g" | sed "s:lonoeste:${west1}:g" |  sed "s:latsul:${south}:g" > ${Eta_ucl}/CTLTEMPLATE

cat ${Eta_ucl}/cntrl.parm_NOPACK_temp | sed "s:ptx:$imout2:g" |  sed "s:pty:$jmout2:g" | sed "s:reseta:${res}:g" | sed "s:lonoeste:${west2}:g" |  sed "s:latsul:${south}:g"> ${Eta_ucl}/cntrl.parm_NOPACK
