awk formatting

view full story

http://www.unix.com – Hi all, I'm writing a simple awk code: Code: awk 'BEGIN {FS="|"};{print "Type\tNumber\ttypes\tTotal";};{print $1, "\t", $2, "\t", $3, "\t", $4, "\t";}' db_query.txt it gives me the result: Type Number types Total XXX 498.0 5100.0 5274.661 Type Number types Total BB 1335.0 1312.0 4556.293 How can i make it in a better format? there is a space in between f fields which are not equal and also how can I omit the second repeated headlines? it is repeated for each line! thanks! (HowTos)