Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a file ABC.txt which has some records like:
hello
ram
mohan

i have a xyz.ksh script which executes oracle packages. I want to call oracle package oracle_pkg('<lines from="" abc.txt="" file="">')using this script.

Now i want to read ABC.txt and iterate through the line calling xyz.ksh on every line and passing that name as parameter to package.
to make it more understandable i am writing it is pseudo English.


read ABC.txt
Loop through the content line by line
variable line which will have every line content
call xyz.ksh passing it oracle_pkg(line)
if EOF
end loop

While answering please bee little descriptive as i have very limited knowledge of UNix/Linux.

thanks in advance.
cheers
Posted

1 solution

quite easy:

$ cat ABC.txt | while read a
do
 xyz.ksh $a # assuming it expects as parameter
 # or
 echo $a | xyz.ksh # reads from its standard input
done


there are good examples here: http://www.well.ox.ac.uk/~johnb/comp/unix/ksh.html[^]
 
Share this answer
 
v2
Comments
Sky8807 18-Jul-14 16:57pm    
Thanks for the help.. but my problem is when i am calling xyz.ksh i will have to pass oracle package and parameter as well something like thing (adding your answer as well)
<pre>
$ cat ABC.txt |
do
xyz.ksh $a # i have to give package name as well something like xyz.ksh oracle_pkg($a)
done
</pre>

Now program is getting issue saying '(' is not accepted.
Vedat Ozan Oner 18-Jul-14 17:06pm    
it depends on your xyz.ksh script implementation. send it here by using 'improve question' and let's see what happens in it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900