Trying to read data multiple times


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trying to read data multiple times
# 1  
Old 12-06-2006
Trying to read data multiple times

I am developing a script to automate Global Mirroring on IBM DS8100's. Part of the process is to establish a global copy and wait until the paired LUN's Out of Sync tracks goes to zero. I can issue a command to display the ouput and am trying to use AWK to read the appropriate field. I am simulating the command output (since I can't do it live) by capturing the output to a file and then reading the file. My problem is I haven't figured out how to use getline to read the file multiple times. Here is what I'm attempting:

while ( EndofRout > 0 ) {
NR = 1
while ( (getline < "/tmp/output.orig") > 0 ) {
OutSyncTrack[NR] = $7
NR++
} # end of while getline to build OutSyncTrack array
#
#
for ( x = 1; x <= NR; ++x ) {
EndofRout = 0
print "EndofRout is " EndofRout
if ( OutSyncTrack[x] != 0 )
EndofRout = 1
continue
}
}

The field $7 starts off as a high number then gradually goes to zero. I can simulate this by editing the file, but my problem is that it is only reading the file once even though $7 is not zero. Any help will be greatly appreciated. Thanks in advance.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies

2. Shell Programming and Scripting

Read multiple text files and copy data to csv

hi i need to extract lines from multiple files to a csv file. for example, i have these 3 files file1.txt date:29dec1980 caller:91245824255 called:8127766 file2.txt date:11apr2014 caller:9155584558 called:8115478 file3.txt date:25jun2015 caller:445225552 called:8117485 (30 Replies)
Discussion started by: lp.descamps
30 Replies

3. UNIX for Dummies Questions & Answers

Extracting data between specific lines, multiple times

I need help extracting specific lines in a text file. The file looks like this: POSITION TOTAL-FORCE (eV/Angst) ----------------------------------------------------------------------------------- 1.86126 1.86973 1.86972 ... (14 Replies)
Discussion started by: captainalright
14 Replies

4. Shell Programming and Scripting

Read multiple files, parse data and append to a file

Hi..Can anyone suggest a simple way of achieving this. I have several files which ends with extension .vcf . I will give example with two files In the below files, we are interested in File 1: 38 107 C 3 T 6 C/T 38 241 C 4 T 5 C/T 38 247 T 4 C 5 T/C 38 259 T 3 C 6 T/C... (8 Replies)
Discussion started by: empyrean
8 Replies

5. UNIX for Dummies Questions & Answers

how to read how many times same result occurs?

Is there a way to read how many times each result occurs in a list, say the list.txt has the results: a c d a f c a d e and I need to know how many times each of them occurs such as : a=3 c=2 ..etc. (5 Replies)
Discussion started by: Iifa
5 Replies

6. Shell Programming and Scripting

need help using one variable multiple times

I apologize for the title but I am not even sure myself what to call this. I am going to use an example of a pizza delivery. I need to make an interactive script that allows users to order a certain number of pizzas, and then choose what they want on each pizza. Here is my code so far.... ... (1 Reply)
Discussion started by: cstadnyk1
1 Replies

7. Shell Programming and Scripting

Running Multiple Times ?

hey mates, I was wondering if someone could assist me with this one, I have couple scripts that I would like to invoke from .sh ( One after another ) Script1 Script2 Script3 Is it possible to run script 2 after script one finished running ? And again start script 3 after script 2... (6 Replies)
Discussion started by: NDxiak
6 Replies

8. Shell Programming and Scripting

Doing one thing multiple times

Hi, I wrote a awk line here: awk 'BEGIN {OFS="\t"} {print $0, int(rand()*($2-$1 + 1) + $1) }' filename Basically what it does is that it takes the start (column 1) and stop (column 2) and generates a random # in between start and stop. I want to take this a step further and have it... (2 Replies)
Discussion started by: phil_heath
2 Replies

9. Shell Programming and Scripting

Read the data from multiple files and sum the value

Hi all, I have a requirement where i have to read multiple files using Shell Script in Korn Shell. each file will have the 3rd line as the amount field, i have to read this amount field and sum it for all the files. any idea on how to achieve this?? (i think i can achieve it using a loop,... (9 Replies)
Discussion started by: nvuradi
9 Replies

10. Shell Programming and Scripting

Trying to read data multiple times

I am developing a script to automate Global Mirroring on IBM DS8100's. Part of the process is to establish a global copy and wait until the paired LUN's Out of Sync tracks goes to zero. I can issue a command to display the ouput and am trying to use AWK to read the appropriate field. I am... (1 Reply)
Discussion started by: coachr
1 Replies
Login or Register to Ask a Question
FORK(2) 							System Calls Manual							   FORK(2)

NAME
fork - create a new process SYNOPSIS
pid = fork() int pid; DESCRIPTION
Fork causes creation of a new process. The new process (child process) is an exact copy of the calling process except for the following: The child process has a unique process ID. The child process has a different parent process ID (i.e., the process ID of the parent process). The child process has its own copy of the parent's descriptors. These descriptors reference the same underlying objects, so that, for instance, file pointers in file objects are shared between the child and the parent, so that an lseek(2) on a descriptor in the child process can affect a subsequent read or write by the parent. This descriptor copying is also used by the shell to establish standard input and output for newly created processes as well as to set up pipes. The child processes resource utilizations are set to 0; see setrlimit(2). RETURN VALUE
Upon successful completion, fork returns a value of 0 to the child process and returns the process ID of the child process to the parent process. Otherwise, a value of -1 is returned to the parent process, no child process is created, and the global variable errno is set to indicate the error. ERRORS
Fork will fail and no child process will be created if one or more of the following are true: [EAGAIN] The system-imposed limit on the total number of processes under execution would be exceeded. This limit is configuration- dependent. [EAGAIN] The system-imposed limit MAXUPRC (<sys/param.h>) on the total number of processes under execution by a single user would be exceeded. [ENOMEM] There is insufficient swap space for the new process. SEE ALSO
execve(2), wait(2) 3rd Berkeley Distribution May 22, 1986 FORK(2)