Sponsored Content
Top Forums Shell Programming and Scripting Using dynamic arrays to extract the values Post 302582468 by sanjaydubey2006 on Friday 16th of December 2011 04:19:40 AM
Old 12-16-2011
Using dynamic arrays to extract the values

Hi all,
We have requirement to generate load timing based on subject areas HOUSEHOLD, BANKING and TRADING. These values are stored in an array SUB_ARR
Code:
SUB_ARR=("HOUSEHOLD" "BANKING" "TRADING")

Based on indicator files produced while processing data for each type, we need to get the stats (using stats -c "%y") of when file was generated. These file names are again stored in array.

Code:
HOUSEHOLD_LIST=("HH1_FILE" "HH2_FILE" "HH3_FILE" "HH4_FILE")

similalry BANKING_LIST and TRADING_LIST

my requirement is dynamically fetch the values of LIST for each SUB_ARR value as below :

Code:
for i in ${SUB_ARR[@]}
do
  SUB_LIST=$i'_LIST'   
  <next_code_lines>
done

In next code lines, now my requirement is to fetch the values for <SUB>_LIST and assign it to variables.
eg for first iteration
SUB_LIST=$i'_LIST' would be HOUSEHOLD_LIST.
now i want to extract the value of HOUSEHOLD_LIST[0] and assign it to a varaible by modifying SUB_LIST in some way.
I tried out many ways but unsuccessful.

Would someone please provide any assistance?
Any help is apprecated.

Thanks
Sam

Last edited by Scott; 12-17-2011 at 08:30 AM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Dynamic variable values

Bit of a newbie :D with regard to unix scripting and need some advice. Hopefully someone can help with the following: I have a predefined set of variables as follows: AAA_IP_ADD=1.1.1.1 BBB_IP_ADD=2.2.2.2 I have a funnction call which retrieves a value into $SUPPLIER which would be... (3 Replies)
Discussion started by: ronnie_uk
3 Replies

2. Shell Programming and Scripting

Extracting dynamic values

Hi, I am stuck with extracting values by combining 2 dynamically extracted values. The code goes like this #!/usr/bin/ksh ID1="abcd" i=1 #this is a dynamic value and keeps on changing b="ID" #this is static now i want the value of ID1 variable. like echo $b$i But echo... (1 Reply)
Discussion started by: chaitanyapn
1 Replies

3. Shell Programming and Scripting

storing values in arrays using shell

Friends, I have to execute a command and store its contents into an array using shell. this is what i have tried #!/bin/bash disk_names = ($(`iostat -xtc | egrep -v "device|nfs" | awk '{print $1}'| tr '\n' ' ' `)) But its throwing an error message as ./test-script ./test-script:... (6 Replies)
Discussion started by: achak01
6 Replies

4. Shell Programming and Scripting

Storing values in arrays using csh

I am reading a number of files but then I want to put the ranges xmin xmax ymin ymax as arrays for each file. Any idea how I can do this??? set j = 1 echo "Welcome $i times" while ( $j <= $i ) echo "$j" set fname = $fin-bst-misf.xy echo " "$fname ... (0 Replies)
Discussion started by: kristinu
0 Replies

5. Shell Programming and Scripting

Cleaning up Arrays with duplicate values

Hey Gang! So I have two Arrays. @linecount and @hit. Now these arrays contain numbers which I'm using as line placeholders on files. I need these two arrays to sync up and not repeat a number. Here are the contents (spam alert) @linecount 1 28 53 86 87 88 89 90 91 92 93 94 (5 Replies)
Discussion started by: adelsin
5 Replies

6. Shell Programming and Scripting

Storing values in arrays

I have the following csh script which lets the use pass the following as an argument -legend=tag1/tag2/tag3/tag4/tag5/tag6/tag7 We pass a number of tags separated by '/'. I want to save the legend tags in an array and have done as below. How can I improve on this as things are getting quite... (3 Replies)
Discussion started by: kristinu
3 Replies

7. Shell Programming and Scripting

arrays and two values

I have requirement where I need to capture the highest values of items from a feed that runs for N hours. For example lets assume my data looks like this first feed ======== appples 10 oranges 20 pears 14 second feed ========== apples 5 oranges 30 pears 1 Last feed... (6 Replies)
Discussion started by: BeefStu
6 Replies

8. Shell Programming and Scripting

dynamic values in a row

hi i have an input file in which there are diffrent values for xxxx,yyyyyy,zzzzzzz how can i arrange the dynamic values of x,y&z in a row. input file: xxxxx 1 yyyyyy 4 yyyyyy 5 zzzzzzzz 7 yyyyyy 13 zzzzzzzz 7 zzzzzzzz 6 yyyyyy 14 yyyyyy 12 zzzzzzzz 4 yyyyyy 4 yyyyyy 5 yyyyyy 6... (6 Replies)
Discussion started by: dodasajan
6 Replies

9. Shell Programming and Scripting

How do I find the sum of values from two arrays?

Hi I have redc containing the values 3, 6, 2, 8, and 1. I have work containing the values 8, 2, 11, 7, and 9. Is there a way to find the sum of redc and work? I need to compare the sum of those two arrays to something else, so is it okay to put that into my END? TY! (4 Replies)
Discussion started by: razrnaga
4 Replies

10. Shell Programming and Scripting

Replace sql with dynamic values

Hi Guys, I am using a function to replace the values dynamically to frame sql query by reading a file. My file will have column names like file.txt col_1 col_2 expected output: select id,col_1,col_2 from ( select a.id, a.col_1, rank() over (ORDER BY cast(a.col_1 AS double)... (5 Replies)
Discussion started by: Master_Mind
5 Replies
GLSHADERBINARY(3G)						   OpenGL Manual						GLSHADERBINARY(3G)

NAME
glShaderBinary - load pre-compiled shader binaries C SPECIFICATION
void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); PARAMETERS
count Specifies the number of shader object handles contained in shaders. shaders Specifies the address of an array of shader handles into which to load pre-compiled shader binaries. binaryFormat Specifies the format of the shader binaries contained in binary. binary Specifies the address of an array of bytes containing pre-compiled binary shader code. length Specifies the length of the array whose address is given in binary. DESCRIPTION
glShaderBinary loads pre-compiled shader binary code into the count shader objects whose handles are given in shaders. binary points to length bytes of binary shader code stored in client memory. binaryFormat specifies the format of the pre-compiled code. The binary image contained in binary will be decoded according to the extension specification defining the specified binaryFormat token. OpenGL does not define any specific binary formats, but it does provide a mechanism to obtain token vaues for such formats provided by such extensions. Depending on the types of the shader objects in shaders, glShaderBinary will individually load binary vertex or fragment shaders, or load an executable binary that contains an optimized pair of vertex and fragment shaders stored in the same binary. ERRORS
GL_INVALID_OPERATION is generated if more than one of the handles in shaders refers to the same shader object. GL_INVALID_ENUM is generated if binaryFormat is not an accepted value. GL_INVALID_VALUE is generated if the data pointed to by binary does not match the format specified by binaryFormat. ASSOCIATED GETS
glGet() with parameter GL_NUM_SHADER_BINARY_FORMATS. glGet() with parameter GL_SHADER_BINARY_FORMATS. SEE ALSO
glGetProgram(), glGetProgramBinary(), glProgramBinary() COPYRIGHT
Copyright (C) 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. AUTHORS
opengl.org opengl.org 06/10/2014 GLSHADERBINARY(3G)
All times are GMT -4. The time now is 12:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy