I am currently having trouble efficiently transposing fields within a txt
file from columns to rows.
I have the following input
:
1 2 3
A B C
D E F
and I would like the output
to be:
1 A D
2 B E
3 C F
As of now I am isolating each field to a new file and transposing with:
awk 'BEGIN {FS="\t";ORS="\t"}1' input | awk 'BEGIN {OFS="\t"} {$1=$1;print}' > output
This is very inefficient and takes up disk space, so I was wondering if this could be accomplished with an awk array
.
Any help would be appreciated, Thank you