Sponsored Content
Top Forums Shell Programming and Scripting Prase a file and stored the result to an array Post 302231798 by Franklin52 on Wednesday 3rd of September 2008 07:19:47 AM
Old 09-03-2008
You can do something like:

Code:
#!/bin/sh

cnt=0

awk -F"=" '{print$3}' file | while read name
do
  arr[$cnt]=$name
  let cnt=cnt+1
done

Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to store query multiple result in shell script variable(Array)

:) Suppose,I have one table A. Table A have one column. Table A have 10 rows. I want this 10 rows store into shell script variable. like #!/bin/ksh v_shell_var=Hi here in call oracle , through loop How can I store table A's 10 rows into v_shell_var (Shell Script Array). Regards, Div (4 Replies)
Discussion started by: div_Neev
4 Replies

2. Shell Programming and Scripting

Outputting formatted Result log file from old 30000 lines result log<help required>

Well I have a 3000 lines result log file that contains all the machine data when it does the testing... It has 3 different section that i am intrsted in 1) starting with "20071126 11:11:11 Machine Header 1" 1000 lines... "End machine header 1" 2) starting with "20071126 12:12:12 Machine... (5 Replies)
Discussion started by: vikas.iet
5 Replies

3. Shell Programming and Scripting

Prase a file and store and result to an array

Dear all, I have a file having the following formats: ThreadFail=Web1=1234 ThreadFail=Web2=2345 ThreadFail=Web3=12 ConnectionFail=DB1=11 ConnectionFail=DB2=22 The number of lines will be different from every time . How can I parse the file and store the result to an a array inside... (6 Replies)
Discussion started by: youareapkman
6 Replies

4. Shell Programming and Scripting

Result set into an array

Hi, I have an issue with the result set. I wanted to run db2 query against db2 server in unix environment using perl script. I wanted to get the result set into an array. $db=<<DB_Name>> connect to $db get connection state this is my query = SELECT DISTINCT 'R' FROM... (0 Replies)
Discussion started by: solo123
0 Replies

5. Shell Programming and Scripting

How to put db2 query result into an array in shell script?

Hello, Can someone please advise me how to put the db2 query reult into an array? For example, the query reults are: string A string B string C Then how do I put them into array=string A array=string B ... (2 Replies)
Discussion started by: hanul
2 Replies

6. Shell Programming and Scripting

how can I check the first character of each variable stored in array

variables are stored in this format D0000, D12345, S1234, D12345 | KestrelPrdV2_0.build.177 - svn 141115 tag as V2.0.0.14 D0000, D12345, S1234, D12345 My question is how can I check the first character of each variable stored in array.It should be start with D or S. Please help... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

7. Shell Programming and Scripting

Assign zero to strings that don't appear in block, store result in AWK array

Hi to all, I have this input: <group> <x "2">Group D</x> <x "3">Group B</x> <x "1">Group A</x> </group> <group> <x "1">Group E</x> <x "0">Group B</x> <x "1">Group C</x> </group> <group> ... (11 Replies)
Discussion started by: Ophiuchus
11 Replies

8. Shell Programming and Scripting

how to output the array result into a matrix

I have a file like this: ASSPASVFETQY,hTRBV12-4,hTRBJ2-5,2 ASSPASTGGDYGYT,hTRBV18,hTRBJ1-2,2 ASSPASGDGYT,hTRBV5-1,hTRBJ1-2,2 ASSPASFPEDTQY,hTRBV27,hTRBJ2-3,2 ASSPARVNYGYT,hTRBV5-1,hTRBJ1-2,2 ASSPARTSGGLNEQF,hTRBV6-4,hTRBJ2-1,2 ASSPARQSYNEQF,hTRBV11-1,hTRBJ2-1,2... (3 Replies)
Discussion started by: xshang
3 Replies

9. Shell Programming and Scripting

ksh : Building an array based on condition result

I want to build an Errorlog. I would like to build an array as I move through the if statements and print the array once all error conditions have been defined. The results need to be comma delimited. tsver will be static "1.9.6(2)" other vars $prit $lt $rt can have the same or a different... (1 Reply)
Discussion started by: popeye
1 Replies

10. Shell Programming and Scripting

Search if file exists for a file pattern stored in array

Hi experts, I have two arrays one has the file paths to be searched in , and the other has the files to be serached.For eg searchfile.dat will have abc303 xyz123 i have to search for files that could be abc303*.dat or for that matter any extension . abc303*.dat.gz The following code... (2 Replies)
Discussion started by: 100bees
2 Replies
XmStringTableParseStringArray(library call)							       XmStringTableParseStringArray(library call)

NAME
XmStringTableParseStringArray -- A convenience function that converts an array of strings to a compound string table SYNOPSIS
#include <Xm/Xm.h> XmStringTable XmStringTableParseStringArray( XtPointer *strings, Cardinal count, XmStringTag tag, XmTextType type, XmParseTable parse, Cardinal parse_count, XtPointer call_data); DESCRIPTION
XmStringTableParseStringArray takes an array of strings, allocates an XmStringTable with an equal number of slots, calls XmStringParseText on each string in strings, and inserts the resulting XmString in the corresponding slot in the XmStringTable. strings Specifies an array of strings of characters as determined by type. count Specifies the number of strings in strings. tag Specifies the tag to be used in creating the result. The type of tag created (charset or locale) depends on the type of the text and the value given. If the value specified is NULL, and type indicates that a charset tag should be created, then the tag will have the value of XmFONTLIST_DEFAULT_TAG. If type indicates a locale tag, then the tag will have the value of XmFONTLIST_DEFAULT_TAG. type Specifies the type of text to be passed in and the type of tag. If the type is either XmMULTIBYTE_TEXT or XmWIDECHAR_TEXT, a locale tag should be created. If the type is XmCHARSET_TEXT, a charset tag will be created. parse Specifies the parse table to be used. parse_count Specifies the number of entries in the parse table. call_data Specifies data to be passed to the parse procedures. RETURN
Returns a new XmStringTable. The function allocates space to hold the XmStringTable. When the application no longer needs the returned XmStringTable, the application should call XmStringFree count times (that is, one time for each returned compound string) and then call XtFree to deallocate the XmStringTable itself. RELATED
XmStringFree(3) and XmTabList(3). XmStringTableParseStringArray(library call)
All times are GMT -4. The time now is 10:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy