03-02-2009
Storing Multiple Values in a Variable
Hi,
My code is as below:
integer i=7
while ((i <= 5 ));
do
# test_out is a variable which contains data separated by "^".
a= `echo $test_out | cut -d"^" -f$i`
echo "$a"
(( i = i + 1));
done
From the above code, i kept $i after f so that i can capture all the data which is separated by "^". Here since "i" is incrementing 5 times, i want to store all the 5 values in variables such as a1,a2,a3,a4,a5 .
How can i do this. If i keep "i" after a it is not working. Ideally instead of keeping 5 commands for a, i want to do it in single shot by keeping ai. But it is not working.
If i do an echo "$ai", it must display all the 5 values since its looping 5 times.
Correct me if i mentioned some thing wrong. I am new to UNIX so it would be great if some body can help me out.
Thanks
Sandeep
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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... (1 Reply)
Discussion started by: matrixmadhan
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am writing a shell script where,
x=y
y=z
When I want to print z, I can do
$y
How do I use only "x" without any direct reference to "y" to print z?
Thanks,
-G (3 Replies)
Discussion started by: gaurab
3 Replies
3. Shell Programming and Scripting
I have a situation where my variable needs to pick up any of the 4 values from the environment it is in
for e.g i am on server named a
server=a (script running on this server)
ftp servers= b c d e ----- the parameter passed should be any of these values in these 4 values, if not throw an... (4 Replies)
Discussion started by: dsravan
4 Replies
4. Shell Programming and Scripting
Am using a find command in my script .The output may be one or more. I need to store those values in a array and need to access those. Am unable to find the solution . Any help on this will be helpful.
if
< code>
else a=<find command output which gives the file name either 1 or more>
if 1... (1 Reply)
Discussion started by: rogerben
1 Replies
5. Shell Programming and Scripting
I am working on a script for Mac OS X that, among many other things, gets a list of all the installed Applications. I am pulling the list from the system_profiler command and formatting it using grep and awk. The problem is that I want to be able to use each result individually later in the script.... (3 Replies)
Discussion started by: cranfordio
3 Replies
6. Shell Programming and Scripting
Hi
I have a requirement like
# e=`ls | grep -e"test" | awk -F " " '{print $1}'`
(0) root @ ptxfv3: /
# echo $e
test test.xml
From this i need to grep the word "test" alone i.e., it is occuring twice I need only one among them
Please help (6 Replies)
Discussion started by: Priya Amaresh
6 Replies
7. Shell Programming and Scripting
Hello I need to alter a script to check for a flag file but there are now more than one type of flag file in my directory. Basically if any of these flg files exist then the MASK value should be set? Flag files to be included in assignment to variable
e2e_scheduled*.flg
COLL_STOP*.flg... (1 Reply)
Discussion started by: andymay
1 Replies
8. Shell Programming and Scripting
Hi,
I am writing a shell script which will check the status of a resource in a cluster and then display nicely to a user running the script at command line.
Basically the script runs a status command and then pulls certain keywords from the return and then should display a concise status.
... (5 Replies)
Discussion started by: chris01010
5 Replies
9. Shell Programming and Scripting
(I am using bash)
I have a command that will find the line number in a file by searching for a string where it exists.
linenumber=$(grep -n "string" $FILENAME | cut -d : -fi)
This returns the line number and removes the string. Now that I have the line number I want to subtract 4 from it and... (5 Replies)
Discussion started by: prodigious8
5 Replies
10. Shell Programming and Scripting
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
LEARN ABOUT LINUX
wxgridsizer
wxGridSizer(3erl) Erlang Module Definition wxGridSizer(3erl)
NAME
wxGridSizer - See external documentation: wxGridSizer.
DESCRIPTION
See external documentation: wxGridSizer .
This class is derived (and can use functions) from:
wxSizer
DATA TYPES
wxGridSizer() :
An object reference, The representation is internal and can be changed without notice. It can't be used for comparsion stored on disc
or distributed for use on other nodes.
EXPORTS
new(Cols::integer()) -> wxGridSizer()
Equivalent to new(Cols, []) .
new(Cols::integer(), Options::[Option]) -> wxGridSizer()
Types Option = {vgap, integer()} | {hgap, integer()}
See external documentation .
new(Rows::integer(), Cols::integer(), Vgap::integer(), Hgap::integer()) -> wxGridSizer()
See external documentation .
getCols(This::wxGridSizer()) -> integer()
See external documentation .
getHGap(This::wxGridSizer()) -> integer()
See external documentation .
getRows(This::wxGridSizer()) -> integer()
See external documentation .
getVGap(This::wxGridSizer()) -> integer()
See external documentation .
setCols(This::wxGridSizer(), Cols::integer()) -> ok
See external documentation .
setHGap(This::wxGridSizer(), Gap::integer()) -> ok
See external documentation .
setRows(This::wxGridSizer(), Rows::integer()) -> ok
See external documentation .
setVGap(This::wxGridSizer(), Gap::integer()) -> ok
See external documentation .
destroy(This::wxGridSizer()) -> ok
Destroys this object, do not use object again
AUTHORS
<>
wxErlang 0.98.9 wxGridSizer(3erl)