The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SQL Select and awk habuzahra Shell Programming and Scripting 6 11-26-2008 01:44 AM
select function nagalenoj High Level Programming 0 06-10-2008 06:42 AM
how to make a line BLINKING in output and also how to increase font size in output mail2sant Shell Programming and Scripting 3 04-14-2008 08:30 AM
Want to use the output of Select statement in Unix script akhilgoel9 Windows & DOS: Issues & Discussions 4 05-27-2005 10:52 AM
select() and read() jnuno High Level Programming 2 11-19-2002 02:03 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-08-2009
deep_bree deep_bree is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
Question using the output of select

hi,
i need to use the output of select query.
the output i get using
"X=`sqlplus -s $var1/$var1<<eof
select port from table1;`
echo $X "

is

"port ----- 2000"
now i want to use only 2000 in my next command.
hw do i do it?
  #2 (permalink)  
Old 05-08-2009
helper helper is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 25
Use
SET HEADING OFF;

This statement should be immediately after you login to sql.


Ideally this is the way it has to look.

"X=`sqlplus -s $var1/$var1<<eof
SET HEADING OFF;
select port from table1;`
echo $X "


Let us know if this worked or not..
  #3 (permalink)  
Old 05-08-2009
deep_bree deep_bree is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
using o/p of select.

thanks a lot helper..
Actually i need two different ports from two different tables.
if i use the earlier script, echo $X shows two ports.
but the next netstat command uses only the first port.
hw can i use the result of echo $x ,say 2000 2001 in netstat command ,to chk whether they r up?
  #4 (permalink)  
Old 05-08-2009
helper helper is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 25
Thumbs up

Use for loop and use the command netstat

"X=`sqlplus -s $var1/$var1<<eof
SET HEADING OFF;
select port from table1;`
echo $X "
for i in `echo $X`
do
netstat -i $X
done
  #5 (permalink)  
Old 05-08-2009
deep_bree deep_bree is offline
Registered User
  
 

Join Date: May 2009
Posts: 3
output of select

hi helper,
thanks.
it worked but with a simple change.ie netstat -an|grep $i
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0