|
|
column-t - iomenu - interactive terminal-based selection menu |
|
|
 |
git clone git://bitreich.org/iomenu git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/iomenu (git://bitreich.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
Tags |
|
|
 |
README |
|
|
 |
LICENSE |
|
|
|
--- |
|
|
|
column-t (381B) |
|
|
|
--- |
|
|
|
1 #!/usr/bin/awk -f |
|
|
|
2 # format text in aligned two-space separated columns: portable column -t |
|
|
|
3 |
|
|
|
4 { |
|
|
|
5 for (f = 1; f <= NF; f++) { |
|
|
|
6 l = length($f) |
|
|
|
7 if (l > len[f]) |
|
|
|
8 len[f] = l |
|
|
|
9 field[NR"|"f] = $f |
|
|
|
10 } |
|
|
|
11 if (--f > count) |
|
|
|
12 count = f |
|
|
|
13 } |
|
|
|
14 |
|
|
|
15 END { |
|
|
|
16 for (row = 1; row <= NR; row++) { |
|
|
|
17 for (f = 1; f < count; f++) |
|
|
|
18 printf("%-"len[f]"s ", field[row"|"f]) |
|
|
|
19 printf("%s\n", field[row"|"f]) |
|
|
|
20 } |
|
|
|
21 } |
|