Output that’s split on spaces looks ragged as soon as the values have different lengths. awk’s printf gives every column a fixed width.
printf 'nginx 12.5\npostgres 300\n' | awk '{printf "%-10s %8.1f MB\n", $1, $2}'
This printed:
nginx 12.5 MB
postgres 300.0 MB
%-10s is a text column 10 characters wide, aligned to the left because of the minus. %8.1f is a number 8 characters wide with one decimal, aligned to the right, so the decimal points line up. Unlike print, printf doesn’t add a newline, which is why the \n is there.
I like to add a header in the same format, so the table explains itself:
awk 'BEGIN {printf "%-10s %8s\n", "NAME", "SIZE"} {printf "%-10s %8.1f\n", $1, $2}' sizes.txt
When a value is longer than its width, printf doesn’t cut it off; it pushes the rest of the line to the right. Pick widths for the longest value you expect, or use %-10.10s to truncate text at 10 characters. And as with length, some awks count bytes, so names with accents can end up one column off in mawk.
Further reading: GNU awk manual, POSIX awk specification