#!/usr/bin/awk -f { if (NF > maxnf) maxnf = NF for (i = 1; i <= NF; i++) { l = length($i) if (l > ar[i]) { ar[i] = l ex[i] = $i } } } END { for (i = 1; i <= NF; i++) { printf("%2d %2d %s\n", i, ar[i], ex[i]) } }