#! /bin/ksh #----------------------------------------------------------# # PROGRAM: sip # # # # CREATED by Vijay Mitra 05 Dec 2000 # # # # DESCRIPTION: Sybase server ip address of an Environment. # # # # NB: Need to change "Variables" depending on environment. # #----------------------------------------------------------# echo "\n####################################################" echo "sip a simple utility to show the Sybase Ip Address " echo "PROGRAMMER : Vijay Mitra " echo "Usage : sip [SERVER] " echo "####################################################\n" if [ $# -ne 1 ] then SERVER=$DSQUERY else SERVER=$1 fi echo "Working on Server $SERVER" INTERFACESFILE=$SYBASE/interfaces LINE=`awk 'BEGIN {FS = "\n" ; RS = "" } $1 == server { print $2 } ' "server=$SERVER" $INTERFACESFILE | cut -f2 -d'x'` if [ -z $LINE ] then echo "Error : Server details for $SERVER not found in $INTERFACESFILE file.\n" exit fi P1=`echo $LINE|cut -c9-10 |tr '[a-z]' '[A-Z]'` P2=`echo $LINE|cut -c11-12 |tr '[a-z]' '[A-Z]'` P3=`echo $LINE|cut -c13-14 |tr '[a-z]' '[A-Z]'` P4=`echo $LINE|cut -c15-16 |tr '[a-z]' '[A-Z]'` P5=`echo $LINE|cut -c5-8 |tr '[a-z]' '[A-Z]'` echo "ibase=16\n$P1\nquit\n" > /tmp/x P1=`bc /tmp/x` echo "ibase=16\n$P2\nquit\n" > /tmp/x P2=`bc /tmp/x` echo "ibase=16\n$P3\nquit\n" > /tmp/x P3=`bc /tmp/x` echo "ibase=16\n$P4\nquit\n" > /tmp/x P4=`bc /tmp/x` echo "ibase=16\n$P5\nquit\n" > /tmp/x P5=`bc /tmp/x` rm /tmp/x echo "IP Address fror $SERVER is : $P1.$P2.$P3.$P4,$P5\n"