Matrix transposition: Difference between revisions

Content added Content deleted
Line 391: Line 391:
# syntax: GAWK -f MATRIX_TRANSPOSITION.AWK filename
# syntax: GAWK -f MATRIX_TRANSPOSITION.AWK filename
{ if (NF > nf) {
{ if (NF > nf) {
nf = NF
nf = NF
}
}
for (i=1; i<=nf; i++) {
for (i=1; i<=nf; i++) {
row[i] = row[i] $i " "
row[i] = row[i] $i " "
}
}
}
}
END {
END {
for (i=1; i<=nf; i++) {
for (i=1; i<=nf; i++) {
printf("%s\n",row[i])
printf("%s\n",row[i])
}
}
exit(0)
exit(0)