It is currently Tue, 30 Nov 2021 17:56:52 GMT



 
Author Message
 script for feeding a record each time from a data base file
hi there,

anyone can help for the following problem:

a file containing several fields and records, each time feed one record into a varible and then run some function, until the end of the file

e.g. file

------------------

field1 field2

A    1

B    2

C    3

------------

each time assign one record of field1 to variable 1 and one record of field2 to variable 2

i.e

var1 = A

var2 = 1

then run function(var1, var2),

then

var1 = B

var2 = 2

and run function(var1, var2) again

the procedure continues until reading the end of the records of the file.

best rgds,

--
Kelvin Tai
kelvin....@ieee.org



 Wed, 23 Apr 2003 13:17:08 GMT   
 script for feeding a record each time from a data base file
In article <3A039BD3.75562...@iee.org>, Kelvin Tai  <kelvin....@iee.org> wrote:

Is there something wrong with the standard idiom:

while read var1 var2
do
  function $var1 $var2
done

--
Barry Margolin, bar...@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



 Thu, 24 Apr 2003 03:00:00 GMT   
 
   [ 2 post ] 

Similar Threads

1. script command (data record) help

2. script for data record manipulation?

3. Script process to select first and last time-stamped records

4. how to find out if a script is fed by a pipe or file

5. splitting a very large file based on characters in a record (performance)

6. Create Files Based On Input Records

7. email to data base script

8. how to search the duplicated records in a data file

9. script to compare based on time

10. adding a line feed ascii 10 to end of record


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software