From: Joel VanderWerf Date: 2008-07-16T14:05:46+09:00 Subject: Re: printing columns Michael Pope wrote: > I'm trying to print some data to the terminal in columns and haven't > seen a way to do it properly. I've tried "fred".center(80) to try and > center the text at column 80 but when I start entering data before > "fred" it starts to push "fred" over to the right. > > Is there a way to print at a specific column regardless of what text is > on the same line before hand or after? Use an excape char sequence to move forward? $ ruby -e 'print "0123456789"*8; print "\r"; puts "fred".center(80).gsub(" ", "\e[C")' 01234567890123456789012345678901234567fred23456789012345678901234567890123456789 -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407