Allign the output

Hi
I have an SQL which returns me the o/p as below in an unformatted manner

Table     Size            No. 
=============================================
DEF        22                 2
PAF   3                 1
99D        12                 1
USERS        6                 1
04D     4                    1       

I would like to have it alligned as below . Please advice.

Tablespace      Size            No. 
============================================
DEF            22                 2
PAF            3                  1
99D            12                 1
USERS          6                  1
04D            15                 1

Thanks.

Try this:

awk '$1=$1' OFS="\t\t" file > newfile

Or pipe it through this for example..

awk '{printf("%-15s%6s%15s\n",$1,$2,$3)}'

Hi.

Thanks..
But this gives me the below error

awk '$1=$1' OFS="\t\t" m.log > newm.log
awk: syntax error near line 1
awk: bailing out near line 1

---------- Post updated at 05:29 PM ---------- Previous update was at 05:27 PM ----------

Hey Scrutinizer.

Thanks. This did work. thankyou!!

Use nawk or /usr/xpg4/bin/awk on Solaris.