I would like to transpose column to row by every 3rd column.
Input.txt
Name
Age
Place
aa
22
xx
bb
33
yy
cc
44
zz
....
....
Desired Output
Name,Age,Place
aa,22,xx
bb,33,yy
cc,44,zz
I have tried below command and in-complete
awk '
{
for(c = 1; c <= NR; c++) { a[c]=$c }
}
END {
for(r = 1; r <= NR; r++) {
for(t = 1; t <= 3; t++) {
printf("%s ", a[c])
}
print ","
}
}' Input.txt
Looking for your suggestions...