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
Storing count(*) into unix variable mervinboyz Shell Programming and Scripting 1 03-26-2008 11:14 PM
Storing a variable? hoover90 Shell Programming and Scripting 4 01-26-2008 09:39 PM
storing database query in a variable debu Shell Programming and Scripting 3 11-25-2007 07:59 PM
Storing the output into a variable ravi raj kumar UNIX for Dummies Questions & Answers 7 12-11-2006 09:14 AM
storing output of awk in variable mab_arif16 Shell Programming and Scripting 3 05-07-2006 06:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-31-2005
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
Storing values in variable

Hi All,

Here is the description of the problem.

I am scripting for database access using k-shell on solaris box
dbaccess <databasename> - << EOF 2>/dev/null | awk 'BEGIN {FS=" "}\
{printf "%s", $1}' | grep -v "^$" | \
read cnt1
OUTPUT TO PIPE cat WITHOUT HEADINGS
select count(*) from <tablename>;

/* In the above case the output is static that is we get only one value as the
output i amnt bothered abt the value and only the number of values obtained as output - here no of output is always = 1 */


select <col1>, <col2> from <tablename>
where <somecondition>;

/* In this case, based on the condition the output ---- > that is the no of values generated as output is varying and that in multiples of two ********
My question is how to store all the values in to variables.. preferably arrays as i have stored the output of the first query into variable cnt */

kindly help me with this issue.
  #2 (permalink)  
Old 04-01-2005
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2004
Location: USA
Posts: 511
You may try

set -A arr `dbaccess ...`
Sponsored Links
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 06:07 AM.


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