Sponsored Content
Top Forums Shell Programming and Scripting Split the file and access that files through array and loop Post 302763521 by kalidoss on Wednesday 30th of January 2013 05:47:29 AM
Old 01-30-2013
Hi Corona,

I have tried your code , i got the below error...

syntax error at line 6 : `done' unexpected

regards,
Kalidoss
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Access value outside awk or split value of array

Hello I am new to Unix. Please help me out. My Scenario: I am first collecting all the file names present in the directory with structure myinfo/yourinfo/supplierinfo I have four files with the names myCollector.java, yourCollector.java, someCollector.java, everyCollector.java. in the directory.... (1 Reply)
Discussion started by: jason.bean
1 Replies

2. Shell Programming and Scripting

split and making an array inside another array

I want to run an awk split on a value that has been pushed through an array and I was wondering what the syntax should be?? e.g. running time strings through an array and trying to examine just minutes: 12:25:30 10:15:13 08:55:23 awk ' NR==FNR{ ... (2 Replies)
Discussion started by: dcfargo
2 Replies

3. Shell Programming and Scripting

How to run a loop for assigning strings which are present in a file to an array

Hi Forum, I am struggling with the for loop in shell script. Let me explain what is needed in the script. I have a file which will conatin some strings like file1 place1 place2 place3 checkpoint some other text some more text Now what my requirement is the words ... (2 Replies)
Discussion started by: siri_14
2 Replies

4. Shell Programming and Scripting

Not access variable outside loop when a reading a file

I am writing a shell script using the korn shell. It seems that I am only able to use local variables within a while loop that is reading a file. (I can't access a variable outside a previously used while loop.) It's been a while since I wrote shell scripts. Here is a sample cat file.txt... (4 Replies)
Discussion started by: ricardo.ludwig
4 Replies

5. Shell Programming and Scripting

Push records to array during implicit loop and write to file

NEWBIE ALERT! Hi, I'm 1 month into learning Perl and done reading "Minimal Perl" by Tim Maher (which I enjoyed enoumously). I'm not a programmer by profession but want to use Perl to automate various tasks at my job. I have a problem (obviously) and are looking for your much appreciated help.... (0 Replies)
Discussion started by: jospan
0 Replies

6. Shell Programming and Scripting

problem access array outside of loop in bash

Below is a test script I was trying to use so that I could understand why the logic was not working in a larger script. While accessing and printing array data inside the while loop, everything is fine. Outside the loop, i guess everything is null?? The for loop that is meant to cycle... (4 Replies)
Discussion started by: adlmostwanted
4 Replies

7. Shell Programming and Scripting

Array Variable being Assigned Values in Loop, But Gone when Loop Completes???

Hello All, Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....? I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies

8. Shell Programming and Scripting

awk loop using array:wish to store array values from loop for use outside loop

Here's my code: awk -F '' 'NR==FNR { if (/time/ && $5>10) A=$2" "$3":"$4":"($5-01) else if (/time/ && $5<01) A=$2" "$3":"$4-01":"(59-$5) else if (/time/ && $5<=10) A=$2" "$3":"$4":0"($5-01) else if (/close/) { B=0 n1=n2; ... (2 Replies)
Discussion started by: klane
2 Replies

9. Shell Programming and Scripting

Split list of files into an array and pass to function

There are two parts to this. In the first part I need to read a list of files from a directory and split it into 4 arrays. I have done that with the following code, # collect list of file names STATS_INPUT_FILENAMES=($(ls './'$SET'/'$FOLD'/'*'in.txt')) # get number of files... (8 Replies)
Discussion started by: LMHmedchem
8 Replies

10. Shell Programming and Scripting

Split a file into 10 different files

OS : RHEL 6.7 Shell : bash I have a text file with 5.97 million lines. I want to split this big file into 12 different files (in sequential order) so that each file will contain roughly 500K lines. I tried the following awk command after googling. But, it just created 2 files... (5 Replies)
Discussion started by: omega3
5 Replies
gd_add_spec(3)							      GETDATA							    gd_add_spec(3)

NAME
gd_add_spec, gd_madd_spec -- add a field to a dirfile SYNOPSIS
#include <getdata.h> int gd_add_spec(DIRFILE *dirfile, const char *line, int fragment_index); int gd_madd_spec(DIRFILE *dirfile, const char *line, const char *parent); DESCRIPTION
The gd_add_spec() function adds the field described by the field specification line in line to the dirfile specified by dirfile. The gd_madd_spec() function behaves similarly, but adds the field as a metafield under the field indicated by the field parent. Field specifi- cation lines are described in detail in dirfile-format(5). Since Standards Version 7 (see dirfile(5)) permits specifying metafield without the use of the /META directive, gd_add_spec() may also be used to add metafields, by specifying the metafield's full field code. See dirfile-format(5) for full details. When using gd_madd_spec(), line should only contain a field specification, and not a /META directive. Passing these functions a directive line instead of a field specification line will result in a syntax error. These functions never call the registered parser callback function, even if line contains a syntax error. RETURN VALUE
On success, gd_add_spec() and gd_madd_spec() return zero. On error, -1 is returned and the dirfile error is set to a non-zero error val- ue. Possible error values are: GD_E_ACCMODE The specified dirfile was opened read-only. GD_E_ALLOC The library was unable to allocate memory. GD_E_BAD_CODE The parent field code was not found, or was already a metafield. GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_BAD_INDEX The fragment_index argument was out of range. GD_E_FORMAT A syntax error was encountered in line. GD_E_LINE_TOO_LONG The supplied line was longer than the parser was able to deal with. Lines are limited by the storage size of ssize_t. On 32-bit systems, this limits line to 2**31 bytes. The limit is larger on 64-bit systems. GD_E_PROTECTED The metadata of the fragment was protected from change. Or, the creation of a RAW field was attempted and the data of the fragment was protected. GD_E_RAW_IO An I/O error occurred while creating an empty binary file to be associated with a newly added RAW field. GD_E_UNKNOWN_ENCODING The encoding scheme of the indicated format specification fragment is not known to the library. As a result, the library was un- able to create an empty binary file to be associated with a newly added RAW field. GD_E_UNSUPPORTED The encoding scheme of the indicated format specification fragment does not support creating an empty binary file to be associated with a newly added RAW field. The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3). SEE ALSO
gd_add(3), gd_add_bit(3), gd_add_carray(3), gd_add_const(3), gd_add_divide(3), gd_add_lincom(3), gd_add_linterp(3), gd_add_multiply(3), gd_add_phase(3), gd_add_recip(3), gd_add_raw(3), gd_error(3), gd_error_string(3), gd_madd(3), gd_madd_bit(3), gd_madd_carray(3), gd_madd_const(3), gd_madd_divide(3), gd_madd_lincom(3), gd_madd_linterp(3), gd_madd_multiply(3), gd_madd_phase(3), gd_madd_polynom(3), gd_madd_recip(3), gd_madd_string(3), gd_metaflush(3), gd_open(3), dirfile-format(5) Version 0.7.0 4 November 2010 gd_add_spec(3)
All times are GMT -4. The time now is 07:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy