#! /usr/bin/gawk -f BEGIN{ # Reads a bunch of lines, prints them columnwise. # Can be used only for iso-latin-1 or ascii files. split("", a) nrows=0 ncols=0 } // { nrows++; a[nrows] = $0; nc = length($0) if (nc > ncols) { ncols = nc; } next; } END { for (c = 1; c <= ncols; c++) { for (r = 1; r <= nrows; r++) { wd = a[r]; ch = ( c > length(wd) ? " " : substr(a[r], c, 1)) printf "%s", ch; } printf "\n" } }