View Single Post
Old 08-15-2004, 12:06 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
writting progress to cl on one line

I use php4-cgi to write scripts on my linux box. The scripts are going through lots of data and I want to print output to the screen as it runs.

Printing output to the screen is no problem, but it prints out line for line, and soon enough your screen is full of lines.

I've seen a perl program that keeps all the output on 1 line. it updates the same line till it is complete.

so, even though it prints a new value for each % it is complete, here is how a program calld "someprogram.pl" would look after running it:
Code:
$ ./someprogram.pl
[ 50%] Complete
does that make sense? normally it would read
Code:
$ ./someprogram.pl
[  1%] Complete
[  2%] Complete
[  3%] Complete
.. and so on
Any ideas how to keep output to 1 line?
__________________
Mike
sde is offline   Reply With Quote