From: "Michael W. Ryder" <_mwryder@...> Date: 2008-08-20T08:16:36+09:00 Subject: Re: overprinting characters Matt Harrison wrote: > I have a script that does things to large files > 1Gb and I want to be > able to show the percentage through the current file. > > I know exactly how I will get the percentage, but I want to know how to > display it in the terminal. > > What I would like is the name of the current file, then on the next > line, "currentbytes/totalbytes [xx%]" and I want it to update the > characters in place without writing hundreds of lines to the terminal. > > I think I want to be able to position the cursor back to the beginning > of the current line but I have no idea how to do this in ruby. > > Grateful for any ideas > > Thanks > > Matt > You can use curses with Ruby to do what you want. Otherwise if you can figure out how to get Ruby to properly handle the CR character that may be a simpler way. I am not sure how to get Ruby to print a character without interpreting it -- i.e. print 0xa prints 10 instead of a carriage return.