03-19-2010
how to read delimited text into array
I am trying to parse a string using delimited char into array.
BNAME=B10,B20,B30
B10.Q=X
B20.Q=Y
B30.Q=Z
I need to parsethe BNAME into array, then i will loop through array to execute command using these variables. like:
for i in $array
do
qload array[i] array[i].Q # execute command: qload B10 X
done
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
I have been stuck on this aspect of loading a comma delimited file into an array. I thought i had the syntax right, but my commands are not working the way I want them to. Basically my cut command is splitting the file up by spaces and commas. I want the cut command to ignore white spaces.... (2 Replies)
Discussion started by: grandtheftander
2 Replies
2. UNIX for Dummies Questions & Answers
OK, let's set this up. I have a tab delimited file from excel. In my UNIX shell I have the following lines
IFS=`printf "\t"`
while read LINE_NO SKIP IGNORE_ERRORS OTHER
do
....
This works fine if there is something in every column like this. NOTE, those are tabs, not spaces. :)
... (2 Replies)
Discussion started by: podzach
2 Replies
3. UNIX for Dummies Questions & Answers
Hello Gurus,
I have a text file containing nearly 12,000 tab delimited characters with 4000 rows. If the file size is small, excel can convert the text into coloumns. However, the file that I have is very big. Can some body help me in solving this problem?
The input file example,
... (6 Replies)
Discussion started by: Unilearn
6 Replies
4. Shell Programming and Scripting
I have an array and two variables as below,
I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.
I need the output inside an ARRAY
How can this be done.
Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies
5. Shell Programming and Scripting
Hi i am new in scripting
how i can get 2 elements from first line of delimited txt file in shell scripts.
AA~101010~0~AB~8000~ABC0~
BB~101011~0~BC~8000~ABC~
CC~101012~0~CD~8000~ABC0~
DD~101013~0~AB~8000~ABC~
AA~101014~0~BC~8000~ABC0~
CC~101015~0~CD~8000~ABC~
can anyone plse help?... (3 Replies)
Discussion started by: sushine11
3 Replies
6. Shell Programming and Scripting
Hello,
I need help in fetching data from a delimited file , into a 2D array.
Sample Input File:
"|" as delimiter
A|123|446pr;
B|46|hello89
krp;
C|78|ystp90
67;
D|ga|456;
Please be advised that ";" is the line separator (not "\n"). Could you please write an awk script to... (5 Replies)
Discussion started by: vinay4889
5 Replies
7. Shell Programming and Scripting
Hello folks, I have another doozy. I have two files. The first file has four fields in it. These four fields map to different locations in my second file. What I want to do is read the master file (file 2 - 23 fields) and compare each line against each record in file 1. If I get a match in all four... (4 Replies)
Discussion started by: dagamier
4 Replies
8. Shell Programming and Scripting
hi,
i have a variable which contains some file names separated by comma. example
FNAME="abc.txt,def.txt,ghi.txt"
i want to extract each filename and store it into an array and also count the number of files in the array.
file=abc.txt
file=def.txt
file=ghi.txt
i thought of using the... (8 Replies)
Discussion started by: Little
8 Replies
9. Shell Programming and Scripting
I have a delimited file (,) containing Name, Amount,Type,Address,zip,Tel and Extn. If any of this column information is missing (except TYPE and Extn),
I need to print that a spefic column value is missing in my output.
Example: row 2 is missing ZIP and the out put should contain NOZIP in... (1 Reply)
Discussion started by: meet_calramz
1 Replies
10. UNIX for Dummies Questions & Answers
Hi, I have a rquirement in unix as below .
I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column.
ex:
Input Text file:
1|A|apple
2|B|bottle
excel file to be generated as output as... (9 Replies)
Discussion started by: raja kakitapall
9 Replies
LEARN ABOUT REDHAT
xmstringtableunparse
XmStringTableUnparse(library call) XmStringTableUnparse(library call)
NAME
XmStringTableUnparse -- A convenience function that converts a table of compound strings to an array of text
SYNOPSIS
#include <Xm/Xm.h>
XtPointer * XmStringTableUnparse(
XmStringTable table,
Cardinal count,
XmStringTag tag,
XmTextType tag_type,
XmTextType output_type,
XmParseTable parse,
Cardinal parse_count,
XmParseModel parse_model);
DESCRIPTION
XmStringTableUnparse takes an array of compound strings, allocates a string array for the type of characters determined by type with an
equal number of slots, calls XmStringUnparse on each compound string in table, and inserts the resulting string in the corresponding slot
in the array.
table Specifies an XmStringTable containing the compound string to be converted.
count Specifies the number of compound strings in table.
tag Specifies the tag to be used in matching with text segments. The two types of tag types are XmFONTLIST_DEFAULT_TAG and
_MOTIF_DEFAULT_LOCALE. Only segments tagged with tag will be returned. If tag is NULL, all segments will be matched.
tag_type Specifies the type of tag to be searched for. These types include XmMULTIBYTE_TEXT, XmWIDECHAR_TEXT, and XmCHARSET_TEXT.
output_type
Specifies the type of text to be generated. These types include XmMULTIBYTE_TEXT, XmWIDECHAR_TEXT, and XmCHARSET_TEXT.
parse Specifies the parse table to be used.
parse_count
Specifies the number of items in parse.
parse_model
Specifies which non-text components to be considered in matching in parse_table. Possible values are:
XmOUTPUT_ALL
Puts out all matching components.
XmOUTPUT_BETWEEN
Puts out only those matching components that are between two matching text components.
XmOUTPUT_BEGINNING
Puts out only those matching components that are at the beginning of a matching text component.
XmOUTPUT_END
Puts out only those matching components that are at the end of a matching text component.
XmOUTPUT_BOTH
Puts out only those matching components that are at the beginning or end of a matching text component.
RETURN
Returns an allocated array of allocated strings. The application is responsible for managing the allocated space. The application can
recover the allocated strings space by calling XtFree count times (that is, one time for each allocated string). The application can then
recover the allocated array by calling XtFree on the allocated array itself.
RELATED
XmStringTab.
XmStringTableUnparse(library call)