|
|
Question : shell script connect to the database and printing the results
|
|
#!/bin/ksh
clientlist=`awk '{print $1}' client_names.txt` echo "$clientlist\n" for client in $clientlist do results=`isql -w200 -Sservername -Uuser -Ppasswd <select ip_address from common.dbo.client_info where environment = 'NON-PROD' and dbName = "$client" go EOF echo "${results}\n"; done
but results are printed something like this
ip_address ------------- 124.100.300.12
ip_address ------------- 123.100.200.12
but i just need the ip address not the headers how could I avoid that?
|
Answer : shell script connect to the database and printing the results
|
|
you'd have to do it like this:
ip_address=`echo "${results}"|tail +3`
|
|
|
|