Sponsored Content
Top Forums Shell Programming and Scripting Bash: Reading out rows of a file into a dynamic array and check first literal Post 302339863 by ABE2202 on Friday 31st of July 2009 02:18:31 PM
Old 07-31-2009
Hello Thanks,

I'll try it, but how can I handle assigning a dynamic number of stings into arrays?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is there any commands to check the dynamic changes of a file

Hi guys i had a script which will generate a log file.Is there any commands to check the dynamic changes in the log file,i.e if i open the log file i should able to see the updating changes live...I hope u understand my query... (2 Replies)
Discussion started by: vinoo
2 Replies

2. Programming

Creating an array to hold posix thread ids: Only dynamic array works

I am facing a strange error while creating posix threads: Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output. Snippet 1 This works: -------------- int *threadids; threadids = (int *) malloc (num_threads * sizeof(int)); ... (4 Replies)
Discussion started by: kmehta
4 Replies

3. UNIX for Dummies Questions & Answers

Reading a file into an array

I have a file that is a text file, how to get all the words into and array, i am able to get each line but not each word :(. Here is what i searched and already found...https://www.unix.com/shell-programming-scripting/99207-pipe-text-file-into-array.html. This one reads a whole line into... (6 Replies)
Discussion started by: SasankaBITS
6 Replies

4. Shell Programming and Scripting

Reading from a file and assigning to an array in perl

I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value. I was thinking the best way to... (1 Reply)
Discussion started by: billprice13
1 Replies

5. Shell Programming and Scripting

reading data from a file to an array

I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array? while read line; do read -A array <<<$line n=${#array} for ((i=1;i<$n;i++)); do print... (1 Reply)
Discussion started by: gavin_L
1 Replies

6. Shell Programming and Scripting

Reading a file into array

Hi, I need to read a file into array and print them in a loop:- 1st file :-cat a.txt RC1 RC2 RC3 RC4 My Program:- #!/bin/ksh index=0 while do read cnt<a.txt print "cnt value is ${cnt} index=`expr $index + 1` done Code tags for code, please. (5 Replies)
Discussion started by: satishmallidi
5 Replies

7. Shell Programming and Scripting

Reading a file into an array

Hi I have a file with contents as below : server | ABC Issue : File System Missing XYZ Issue : Wrong Syntax PQR Issue : Old File to be removed Now I am looking for an o/p similar to server <tab> ABC Issue : File System Missing <tab> XYZ Issue : Wrong Syntax <tab>... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

8. Shell Programming and Scripting

Help w/ Reading Matrix & Storing in dynamic array

First of I would just like to state that I am not looking for you guys to just do my work for me, I do want to learn and actually understand everything that is happening. Hey all, I am having trouble on this. What I need to do is... Write an executable C file that will take a text file (not a... (8 Replies)
Discussion started by: innvert
8 Replies

9. Shell Programming and Scripting

Reading a long literal continued next line

I am trying to identify all messages or prompts from a number of COBOL programs and they can usually be identified by a pair of double quotes on one line. However, sometimes the literal will not be finished on the first line but after a dash in column 7 of the next line, the literal will be... (6 Replies)
Discussion started by: wbport
6 Replies

10. UNIX for Dummies Questions & Answers

Check for empty line at end of a dynamic header in each file

Hi Folks, I have a requirement to develop a shell script. PFB my requirement, Requirement: I need to check an empty line after the end of each header in respective file and if a empty line is present simply echo file OK and if empty line is not present echo "Adding empty line" and add an... (6 Replies)
Discussion started by: tpk
6 Replies
ggGetScope(3)								GGI							     ggGetScope(3)

NAME
ggGetScope, ggFromScope, ggDelScope, ggNewScope - Portable code module loading facilities SYNOPSIS
#include <ggi/gg.h> gg_scope ggGetScope(const char *location); void ggDelScope(gg_scope scope); void *ggFromScope(gg_scope, const char *symbol); typedef void *(*ggfunc_scope_get)(void * handle, const char * symbol); typedef void (*ggfunc_scope_del)(void * handle); gg_scope ggNewScope(const char * location, void * handle, ggfunc_scope_get get, ggfunc_scope_del del) DESCRIPTION
LibGG abstracts dynamic code loading (and emulates dynamic code loading for statically linked embedded binaries) through a simple API which represents the very lowest level required of any loadable module system. The actual underlying mechanisms used in various operating sys- tems to load additional code into an application on demand vary drastically, however, minus OS-specific frills, they can all be mapped to the above three LibGG API functions. ggGetScope finds a loadable collection of symbols known by its location through whatever system is available on the operating system. Those symbols were once supposed to be code from modules, but the scope abstraction does not impose this restriction. The scopes can have different implementations and are not restricted to dynamic libraries. They could also be used as an interface to a attribute/value config- uration system. Note that when a scope happens to be dynamic library, the symbols are loaded into the address space of the caller, but libgg does not guar- antee that the imported symbols will be seen by other modules. ggDelScope unloads the symbol collection represented by the handle scope, which must have been previously loaded with ggGetScope (scope should be a return value from a previous call to ggGetScope.) Reference counts are kept to ensure that redundantly loaded symbol collec- tions are not discarded until their last owner releases them. Calling ggDelScope on a handle too many times, or on an invalid handle, may produce undefined results. Accessing symbols after the collections they were contained in are unloaded will produce undesirable and unde- fined results. ggFromScope searches the symbol collection represented by the handle scope, which has been loaded with ggGetScope (and not yet unloaded with ggDelScope, of course) for a symbol named symbol, so that the application may use the item associated with the symbol. The parameter scope should be a return value from a previous call to ggDelScope. As ggFromScope may have no way of knowing what the symbol represents, the application must take the responsibility for assigning the item a correct C type. ggNewScope allows to register a custom scope to libgg. The primary purpose is to allow libraries to provide builtin modules that are acces- sible through the same interface as dynamic ones. location is the string at which the scope can be retreived. handle is a opaque pointer provided by the caller that will be passed to the callbacks. get is a function that take an opaque handle, a symbol name, and that must return the requested symbol address, or NULL if not found. del is a function that will take the provided handler, and that must cleanup everything before the scope is removed from the scope registry. This scheme allows to implement all kind of scopes in a very flexible way. Note that ggNewScope will take a reference on the scope. RETURN VALUE
On success, ggGetScope returns an opaque pointer to a handle representing a newly loaded symbol collection (which must be retained in order to use or free the collection.) These pointers are not guaranteed to be unique. On failure, ggGetScope returns NULL. ggFromScope returns the address of the item that the named symbol represents, if it has been loaded into the caller's address space. Oth- erwise it returns NULL. Note that the value associated to a symbol really depends on the scope itself and the caller must know what is behind it. So a NULL value does not necessarily means failure. It could be a valid value for a specific scope. ggNewScope returns an opaque pointer to a handle representing the custom scope. On failure, ggNewScope returns NULL. libgg-1.0.x 2005-08-26 ggGetScope(3)
All times are GMT -4. The time now is 06:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy