Sponsored Content
Top Forums Shell Programming and Scripting How to load different type of data in a file to two arrays Post 302245015 by ahjiefreak on Thursday 9th of October 2008 07:06:49 AM
Old 10-09-2008
Thanks Era and cfajohnson,

Appreciate alot.

But I have a question on the array..after I get that array, how could I know number of entries that the array hold?

I tried

for i in ${yes[@]}
do
total+=1;
done

echo $total

But it gives me weird total number of 11 instead.

E.g I have

1,1,1,1,1,2,yes
1,2,3,4,5,5,yes
2,3,4,5,5,5,no
1,2,3,4,4,2,no
1,1,3,4,5,2,no

The Yes total variable should give me 2 instead.

Any mistakes I did?

Please advise. Thanks.
 

10 More Discussions You Might Find Interesting

1. Programming

FILE data type

Hi all, Can anyone tell me a little about the datatype FILE, which represents stream. What does its structure look like, and in which header file is it defined and so on... Ex : FILE *fp ; fp = fopen("filename", "w") ; (6 Replies)
Discussion started by: milhan
6 Replies

2. Shell Programming and Scripting

Reading in data sets into arrays from an input file.

Hye all, I would like some help with reading in a file in which the data is seperated by commas. for instance: input.dat: 1,2,34,/test for the above case, the fn. will store the values into an array -> data as follows: data = 1 data = 2 data = 34 data = /test I am trying to write... (5 Replies)
Discussion started by: sidamin810
5 Replies

3. Shell Programming and Scripting

Shell Script to Load data into the database using a .csv file and .ctl file

Since i'm new to scripting i'm findind it difficult to code a script. The script has to be an executable with 2 paramters passed to it.The Parameters are 1. The Control file name(.ctl file) 2. The Data file name(.csv file) Does anybody have an idea about it? :confused: (3 Replies)
Discussion started by: Csmani
3 Replies

4. Shell Programming and Scripting

Need help in wrting Load Script for a Load-Resume type of load.

hi all need your help. I am wrting a script that will load data into the table. then on another load will append the data into the existing table. Regards Ankit (1 Reply)
Discussion started by: ankitgupta
1 Replies

5. Shell Programming and Scripting

how to check the file data type(ascii or binary)

hi i am receiving a file from one system , i have to verify the format of the file data i.e whether the data is in acii format or binary format, please help thanks in advance satya (1 Reply)
Discussion started by: Satyak
1 Replies

6. Shell Programming and Scripting

load a data from text file into a oracle table

Hi all, I have a data like, 0,R001,2,D this wants to be loaded into a oracle database table. Pl let me know how this has to be done. Thanks in advance (2 Replies)
Discussion started by: raji35
2 Replies

7. Shell Programming and Scripting

Load data to flat file from table.

Hi all, I need to know how to copy data from a table say ABC to a flat file say XYZ.dat in unix, Please leave ur comments and the fastest way to do so, I need to load the table records into flat file. Regards Ann (4 Replies)
Discussion started by: Haque123
4 Replies

8. Web Development

script to load data from csv file

hello i want a script to load the data line by line from a csv file into a mysql table (3 Replies)
Discussion started by: srpa01red
3 Replies

9. UNIX for Dummies Questions & Answers

Verify the data type in a file with UNIX function

I am seeking help on this UNIX function, please help. Thanks in advance. I have a large file, named as 'MyFile'. It was tab-delmited, I am told that each record in column 1 is unique. How would I verify this with UNIX function or command? (1 Reply)
Discussion started by: duke0001
1 Replies

10. Shell Programming and Scripting

Load data from a flat file to oracle.

I have a flat file with records like Header 123 James Williams Finance2000 124 Pete Pete HR 1500 125 PatrickHeather Engg 3000 Footer The structure is: Eno:4 characters Name:8 characters Surname : 9 characters Dept:7 characters Sal:4characters These are sample... (1 Reply)
Discussion started by: Shivdatta
1 Replies
XkbCopyKeyTypes(3)						   XKB FUNCTIONS						XkbCopyKeyTypes(3)

NAME
XkbCopyKeyTypes - Copy more than one XkbKeyTypeRec structure SYNOPSIS
Status XkbCopyKeyTypes (XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types); ARGUMENTS
- from pointer to array of XkbKeyTypeRecs to copy - into pointer to array of XkbKeyTypeRecs to change - num_types number of types to copy DESCRIPTION
XkbCopyKeyTypes copies num_types XkbKeyTypeRec structures from the array specified by from into the array specified by into. It is intended for copying between, rather than within, keyboard descriptions, so it doesn't check for overlaps. The same rules that apply to the from and into parameters in XkbCopyKeyType apply to each entry of the from and into arrays of XkbCopyKeyTypes. If any allocation errors occur while copying from to into, XkbCopyKeyTypes returns BadAlloc. Otherwise, XkbCopyKeyTypes copies from to into and returns Success. RETURN VALUES
Success The XkbCopyKeyTypes function returns Success when there are no allocation errors. STRUCTURES
Key types are used to determine the shift level of a key given the current state of the keyboard. The set of all possible key types for the Xkb keyboard description are held in the types field of the client map, whose total size is stored in size_types, and whose total number of valid entries is stored in num_types. Key types are defined using the following structure: typedef struct { /* Key Type */ XkbModsRec mods; /* modifiers used to compute shift level */ unsigned char num_levels; /* total # shift levels, do not modify directly */ unsigned char map_count; /* # entries in map, preserve (if non-NULL) */ XkbKTMapEntryPtr map; /* vector of modifiers for each shift level */ XkbModsPtr preserve; /* mods to preserve for corresponding map entry */ Atom name; /* name of key type */ Atom * level_names; /* array of names of each shift level */ } XkbKeyTypeRec, *XkbKeyTypePtr; DIAGNOSTICS
BadAlloc Unable to allocate storage SEE ALSO
XkbCopyKeyType(3) X Version 11 libX11 1.5.0 XkbCopyKeyTypes(3)
All times are GMT -4. The time now is 08:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy