storing multiple values in a array variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting storing multiple values in a array variable
# 1  
Old 07-18-2012
storing multiple values in a array variable

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 [condition]
< code>
else a=<find command output which gives the file name either 1 or more>
if 1 or more values need to perform task on each value. Since my code is working fine for one value got stuck up with multiple values.
rogerben
# 2  
Old 07-18-2012
What's your system? What's your shell?

Storing huge lists of things in the shell is a bad idea. It wastes memory and CPU time, and the size limit for shell variables can often be smaller than you think. Some shells only give you 4 kilobytes -- a page or two of text at most. Do you truly need to store them all? Will a loop do?

Code:
find ... | while read FILE
do
        echo "Processing $FILE"
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to perform multiple operations on a number before storing to a variable?

(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

2. Shell Programming and Scripting

Storing multiple file paths in a variable

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

3. Shell Programming and Scripting

How to get value from array and set those values as a variable

I am new to ksh scripting, specially array. How do i get values from an array and set the value as variable and pass those variables to the different functions?? someone taught me how to get input from a file with have columns i need to read, but now i doesnt know how to set those value to be a... (7 Replies)
Discussion started by: gavin_L
7 Replies

4. Shell Programming and Scripting

storing large data in unix array variable

Hi, I have table in sql ..from this table im storing the first coloumn values in shell array variable ... after this passing this variable as an arugument in SQL procedure. But the proc. is running fine only for 1024 values in array ... How to store more than 1024 values in the array... (5 Replies)
Discussion started by: ankitknit
5 Replies

5. UNIX for Dummies Questions & Answers

Storing values in shell variable

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

6. Shell Programming and Scripting

fetching values using awk and storing into array

hi all I am using awk utility to parse the file and fetching two different vaues from two different record of a record set. I am able to see the result, now i want to store the result and perform some check of each values form database to mark valid and invalid. could you please help me... (3 Replies)
Discussion started by: singhald
3 Replies

7. Shell Programming and Scripting

storing values in a list or array

i have a file called file.txt having the following entries. 2321 2311 2313 4213 i wnat to store these values in a list and i want to iterate the list using loop and store it in another list (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

8. UNIX for Dummies Questions & Answers

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... (1 Reply)
Discussion started by: sandeep_1105
1 Replies

9. Shell Programming and Scripting

split variable values into array

i have these values inside variable $blah BUNGA TERATAI 3 5055 ITH 1 0 0 0 1 1 JADE TRADER 143W ITH 4 0 0 0 4 4 MOL SPLENDOR 0307A ITH 3 0 0 0 3 3 so how do I split them into array with the... (4 Replies)
Discussion started by: finalight
4 Replies

10. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: matrixmadhan
1 Replies
Login or Register to Ask a Question