SyntaxFix
Write A Post
Hire A Developer
Questions
There is a purpose built utility for this,
GNU datamash utility
apt install datamash datamash transpose < yourfile
Taken from this site, https://www.gnu.org/software/datamash/ and http://www.thelinuxrain.com/articles/transposing-rows-and-columns-3-methods