How to use LOOP in Unix Script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to use LOOP in Unix Script?
# 8  
Old 09-20-2010
Quote:
Originally Posted by ustechie
i need not to connect to databse inside the loop as I am already establishing a connection in my script
I don't know of any magic command that talks to the database without making any connection to it.

You could try saving the queries you want to make for later, perhaps in a temp file, then process them in one batch after the inner loop's done.
# 9  
Old 09-21-2010
Can you give me the syntax of the whole db connect command (if it's a command line command)?
# 10  
Old 09-21-2010
better you make spool of all qurey and the grep from that file and then put loop on each record of file .because each time connecting in sql takes cycles of db and take time :-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX shell script for loop issue

Guys, Please help on the below. sample.prm /u/test/: mail=123@gmail.com purgedays=30 zipdays=7 purgefile=log.gz zipfile=log /u/test/: mail=123@gmail.com purgedays=30 purgefile=txt.gz zipfile=txt zipdays=7 (1 Reply)
Discussion started by: AraR87
1 Replies

2. Shell Programming and Scripting

UNIX for loop

Guys, Please help me on the below.. sample.prm /u/test/: mail=123@gmail.com purgedays=30 zipdays=7 purgefile=log.gz zipfile=log /u/test/: mail=123@gmail.com purgedays=30 purgefile=txt.gz zipfile=txt zipdays=7 (2 Replies)
Discussion started by: AraR87
2 Replies

3. Shell Programming and Scripting

UNIX shell script - cut specified line and perform loop

Guys, I have a requirement as below. consider,if i use df command, its getting the below output. file system kbytes used avail %used Mounted on /dev/sample/ 45765 40000 5765 50% / /dev/filesys/ 30000 20000 1000 80% /u .... .... Now i wanted to cut the /u... (11 Replies)
Discussion started by: AraR87
11 Replies

4. Shell Programming and Scripting

foreach loop in unix script

Hi all, I have a script which searches for all sql files in the current directory and replaces all sql files with an underscore with a dash. The next part I need to do is record the number of changes made (underscore to dash) and display this value (e.g.2). This is what I have so far; find /... (17 Replies)
Discussion started by: shawi
17 Replies

5. UNIX for Dummies Questions & Answers

Help with unix for loop

Hi, I have a command that I want to translate to Unix. I mostly work with Windows and because of that I am stuck on a part. What I cannot find on the internet is skipping the first lines in a for loop and using a certain word/token. (I know how to do a normal loop with output) I need to skip... (1 Reply)
Discussion started by: flappy
1 Replies

6. Shell Programming and Scripting

How to loop use while loop in csh script?

Hi all, i got 2 text file. file.txt value.txt i want use C shell script to write out while both of the file got different limit....how i going to write it in 1 while loop? (4 Replies)
Discussion started by: proghack
4 Replies

7. Shell Programming and Scripting

for loop in Unix

This is the content of a file work.log 1 TGBUS I-US 0;15;83 i did this for i in `cat work.log` do echo $i done I wanted the out put to be 1 TGBUS I-US 0;15;83 But the output appears as 1 TGBUS I-US 0;15;83 For Loop treats space as a delimiter. Can i overrride this space as... (10 Replies)
Discussion started by: kinny
10 Replies

8. Shell Programming and Scripting

Unix Shell Script to loop over Directory and send Filesname as parameters

Hi there I'm new to UNIX scripting; I’m stuck with the following I have an Oracle SQL script that takes three parameters 1- File Name 2- File Path 3- File creation date Under UNIX I have a folder where files will be placed frequently and I need to upload those files to Oracle, what I need... (3 Replies)
Discussion started by: windjashi
3 Replies

9. Shell Programming and Scripting

for loop in unix

hi, can any one suggest why the program 2 is not working. only difference is for ab in *.txt for ab in a_DATA.txt b_DATA.txt c_DATA.txt ------------------------------------ Program :1 (working fine) #!/bin/ksh for ab in a_DATA.txt b_DATA.txt c_DATA.txt suf="_" echo "old->... (1 Reply)
Discussion started by: deep_kol
1 Replies

10. Shell Programming and Scripting

Please help with UNIX while loop...

Hi all. I am trying to execute a while loop that reads a log file containing a file listing, and it compares file sizes, etc. But I am getting an error that makes it seem like it is not reading the log file line by line. When I do a 'more' on the log file, it doesn't appear to be wrapped... ... (1 Reply)
Discussion started by: gerard1
1 Replies
Login or Register to Ask a Question