Loop counter variable display

Hello everyone,
how can I send output to the screen from a running script or tcl, in such a way that if a loop is executing I will see the rolling counter on my screen as the records are processed in the loop. I do not want the screen to scroll, though. In other words can a var's value be painted on the screen at a particular location over and over, without necessitating a newline as well as not being placed to the right of the prior value displayed?
I do not seem to get it , I tried all flavors of echo, puts, flush, clear etc. but no success.
I hope you understood my question....
Looking forward to an answer from someone.
Thanks.
G.

You can use the following:

echo -n "^[[1;75H $variable"

To put that into your script, you have to use the insert mode of vi - to put in the ESC character of ^[, you have to use Control-V then Control-[.

echo line above will put the variable value at line 1, position 75 IF your TERM is set correctly.

#! /usr/bin/ksh

x=0
while ((x<100)) ; do
        print -n \\rx = $x
        sleep 1
        ((x=x+1))
done
exit 0