From: Morton Goldberg Date: 2007-07-10T03:21:07+09:00 Subject: Re: Trying to get dynamic output in console On Jul 9, 2007, at 1:28 PM, Michal Sza wrote: > Hello, > I have a little script that processes excel file and I would like the > script to output some sort of status either line or percent number > as it > runs. > How can I output something to console always in the same spot, meaning > that I don't want start new line every time the script advances. > Something like this: > Progress: 51% - I want this number to change and stay in the same > spot. Perhaps the following example will help you. Please note the \r at the beginning of the format strings. 0.step(100, 10) do |i| printf((i < 100 ? "\rProgress: %02d\%" : "\rProgress: %3d\%"), i) $stdout.flush sleep(1) end puts Regards, Morton