Format output from command from variables

Hi , I have below command to that outputs from variables..
command:

 echo $INSTANCE $DATAB  $status $TSLastBackup| awk '{printf("%-8s %-8s \t \n",$1,$2,$3,$4)}'  | tee $LOGF

the ouput is now:

INSTANCE     DATABSE    BACKUP_STATUS    BACKUPTIMESTAMP
-------      --------   --------         --------

ab2f001           ABC        F      20120403200014
ab2t003           DBDCDD          F      20120403200241
ab2t005           ADFDFDFF         F      20120403200341
ab2t006            DFDF           F      20120403200921
ab2t009          DF           Y      20120404200013
ab2t009          DFDF            Y      20120404200049
ab2t016            DFDF          Y      20120404200118
ab2t017      DFDFFD      Y      20120404200204
ab2t099     DFDF         F       20120329200013

I want the ouput looks like below :

all the columns should align to the same lenght

A B C D
X Y X D
M N OP

the Y/F column format should align in a same straight colmns.

any awk or sed command for this

If your shell supports printf, use that instead of echo for formatted output:

$ cat x.dat
ab2f001           ABC        F      20120403200014
ab2t003           DBDCDD          F      20120403200241
ab2t005           ADFDFDFF         F      20120403200341
ab2t006            DFDF           F      20120403200921
ab2t009          DF           Y      20120404200013
ab2t009          DFDF            Y      20120404200049
ab2t016            DFDF          Y      20120404200118
ab2t017      DFDFFD      Y      20120404200204
ab2t099     DFDF         F       20120329200013
$ cat x
#!/bin/ksh

while read a b c d
do
  printf "%7s  %-8s  %1s  %s\n" $a $b $c $d
done < x.dat
$ ./x
ab2f001  ABC       F  20120403200014
ab2t003  DBDCDD    F  20120403200241
ab2t005  ADFDFDFF  F  20120403200341
ab2t006  DFDF      F  20120403200921
ab2t009  DF        Y  20120404200013
ab2t009  DFDF      Y  20120404200049
ab2t016  DFDF      Y  20120404200118
ab2t017  DFDFFD    Y  20120404200204
ab2t099  DFDF      F  20120329200013
$