How to quickly transpose a single line (from horizonal to vertical, or vice versa) can be very useful. For example, we have a large data set with the first row containing the sample IDs. We want to quickly know how many IDs there are and how they are ordered.
At commandline, type "tr ',' '\n' < input.txt > output.txt", where the input.txt file contains the single line of text delimited by comma ",". And the output.txt file will list the line into one column.
input.txt:
12,a,b
output.txt:
12
a
b
If there are more than one line, then this transpose command will transpose all lines into one single column.
If you type "tr '\n' ',' < output.txt > output2.txt", then it will transpose one column into one row. This is basically transposing multilines into one single one.
output.txt:
12,a,b
w x y
y = 9 + Ax
output2.txt:
12,a,b,w x y,y = 9 + Ax
This command takes multiple delimiters, e.g. both "," and "\t", as this way "tr ',\t' '\n' < input.txt > output.txt".