for loop very slow

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers for loop very slow
# 1  
Old 12-18-2001
Data for loop very slow

Dear unix users,

Any comments on this matter or not? I've been facing this kind of problem for very long. Thinking how to make my script move faster instead of using C to write it. I still prefer using Shell script.

Normally a FOR loop will make the script loop for very long time, what to do to avoid using FOR loop or any other subjections?
# 2  
Old 12-19-2001
It really depends on what you are tryin to acheive with your script. You really need to provide more information - because everyone has to guess what your script has to acheive - and any suggestions may in fact be inappropriate for you.

So if you want a better answer - or any answer - give us some more info on your script.

Having said that - using a while loop can increase efficiency - but only if you want to stop looping once a condition has been met. I'm assuming you know while- but if not just check the man pages for 'while'.

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Processing too slow with loop

I have 2 files file 1 : contains ALINE ALINE BANG B ON A B.B.V.A. BANG AMER CORG BANG ON MORENA BANG ON MORENAIC BANG ON MORENAICA BANG ON MORENAICA CORP BANG ON MORENAICA N.A file 2 contains and is seprated by ^ delimiter : NATIO MARKET^345432534 (10 Replies)
Discussion started by: nikhil jain
10 Replies

2. 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

3. Shell Programming and Scripting

Nested Loop becomes slow

Hello I have some nested loop to display files and form menu item. The part of the code is below. I found that after runnining the script for a while the display becomes very slow. Does ksh shell provided any easy way to release variables, reinit, etc. while ];do script=0 ... (2 Replies)
Discussion started by: ekb
2 Replies

4. SCO

Printer is slow

Discussion started by: gagan8877
2 Replies

5. UNIX and Linux Applications

e-mail is slow

The problem is between 2:00 and 5:00 PM. The email (procmail) proccess load up big time. If I do a prstat at 8:00 AM I have about 100 proccess and 30 mails in mailq. Now at 3:50 PM, I have over 1000 proccess from prstat and 600 e-mail in mailq. Some mail takes 2 hours to get out or in. ... (1 Reply)
Discussion started by: photon
1 Replies

6. Solaris

slow access

We had a network hiccup several weeks back and ever since access to my Ultra 10 Solaris machine has been very slow from within the network but very fast when access from outside the local network. Any ideas as to what can cause this? (15 Replies)
Discussion started by: Danno
15 Replies

7. Shell Programming and Scripting

Cut too slow

Hi I am using a cut command in the script which is slowing down the performance of the script .can anyone suggest the other ways of doing the same cut command Record_Type=`echo "$line" | cut -c19-20` *******this is slowing down********* i have 4 more cut commands 2 in one loop and 2 in inner... (3 Replies)
Discussion started by: pukars4u
3 Replies

8. UNIX for Dummies Questions & Answers

scp is slow

All of the sudden scp got really slow ... from 2-3 seconds to 30 seconds. This happened for 5 hours, and then it went back to running fast. Why? If I use the -q qualifier which "Disables the progress meter" could this have any adverse effect? Thanks (1 Reply)
Discussion started by: tomstone_98
1 Replies

9. Post Here to Contact Site Administrators and Moderators


The site has gone slow for quite some time... Can you do somethin abt it (2 Replies)
Discussion started by: DPAI
2 Replies
Login or Register to Ask a Question