fork(14) download
  1. {
  2. for (f = 1; f <= NF; f++) { a[NR, f] = $f }
  3. }
  4. NF > nf { nf = NF }
  5. END {
  6. for (f = 1; f <= nf; f++) {
  7. for (r = 1; r <= NR; r++) {
  8. printf a[r, f] (r==NR ? RS : FS)
  9. }
  10. }
  11. }
Success #stdin #stdout 0.02s 4276KB
stdin
n 1 2
A 01 02
B 02 02
C 01 01 
D 01 01
stdout
n A B C D
1 01 02 01 01
2 02 02 01 01