(Video materials in preparation)
transpose : Transposes rows and columns
Usage : transpose [-i<string>] <file>
Version : Mon Mar 18 17:08:43 JST 2013
Transposes rows in <file> into columns.
If <file> is omitted or specified as "-" then the command
reads from standard input.
$ cat data
1 2 3
A B C
4 5 6
$ transpose data
1 A 4
2 B 5
3 C 6
Transpose the output of the map command
$ cat data
A 10/01 1
A 10/02 2
A 10/03 3
B 10/01 4
B 10/02 5
B 10/03 6
$ map num=1 data | fcols
* 10/01 10/02 10/03
A 1 2 3
B 4 5 6
$ map num=1 data | transpose | fcols
* A B
10/01 1 4
10/02 2 5
10/03 3 6
The "-i" option will add fields where they are missing. The added
field consists of an underscore character ("_").
$ cat data
1 2 3
A B
4 5 6 7
$ transpose -i data
1 A 4
2 B 5
3 _ 6
_ _ 7
If you specify <string> then the missing fields are replaced by <string>.
$ transpose -i@ data
1 A 4
2 B 5
3 @ 6
@ @ 7
The transpose command reads the entire input file into memory.