The only way I got it to work perfectly in terminal (console) was literally padding the string with a loop. The nice part is that you can choose which char to pad it with, like "Text .......... 234". Without manual padding most lines got aligned by printf, but a few remained little out of alignment.
# This gets available cols in terminal window:
w_cols=`tput cols`
col2=15
let "col1=($w_cols - $col2)"
small="Hey just this?"
bigone="Calm down, this text will be printed nicelly"
padchar='.'
let "diff=${#bigone} - ${#small}"
for ((i=0; i<$diff; i++));
do
small="${small}$pad_char"
done
# The '-' in '%-80s' below makes the first column left aligned.
# Default is right all columns:
printf "%-${col1}s\t%${col2}d\n" "$small" 123456
printf "%-${col1}s\t%${col2}d\n" "$bigone" 123
The result is something like
Hey just this?..................................... 123456
Calm down, this text will be printed nicelly ...... 123