awk to output table-like or excel-like columns in linux terminal?

Ivan picture Ivan · Sep 17, 2012 · Viewed 23.3k times · Source

I do a long pipe, that ends with ...| awk '{print $5"\t\t" $3"\t"$4}' in the Linux terminal. The columns are padded with tabs. The first column entries have different number of characters, so the second column results are not perfectly vertical. How to make the table look perfect?

enter image description here

Answer

Kent picture Kent · Sep 17, 2012

try to pipe the result to column -t:

...| awk '{print $5"\t\t" $3"\t"$4}'|column -t

hope it helps