I've got a few giant text files I'd like to transpose and was wondering whether there was any simple way of doing this. They are in various formats, but "matrixy" - that is same number of columns, no missing values.
If I do not want to keep the whole thing in memory I can't think of any way to do it without n*k complexity, where n is the number of lines and k is the number of columns. As the files contain floating point values of varying length the lines aren't the same length I don't think I can read line by line by choosing a specific number of bytes/characters.
Would be nice if a standard tool like plink could do it, but it only seems to handle ped files.
Ps. there are so many columns that awk is unlikely to be up to the task - has a max NF of 32k IIRC.
R has a transpose function, have you tried that? Don't re-invent the wheel if you don't have to.