------------------------------------------------------------------------ pr (column-> matrix, merge files) ------------------------------------------------------------------------ -n ... here n is a number (number of columns) -t ... no header, trailer, file name etc -l ... number of lines in a page (default is 66) -s ... ouput field separator (by default it is a tab) ------------------------------------------------------------------------ columns -> matrix ------------------------------------------------------------------------ Let us start with a single column $ seq 9 1 2 3 4 5 6 7 8 9 Say you want to write this column to a matrix with 3 columns. You do not wish to use the standard "header" and "trailer" etc. So "-t". Finally, you wish to have OFS=",". $ pr -3 -t -s, <(seq 9) 1,4,7 2,5,8 3,6,9 Now, say you want to write "across" (transpose) $ pr -3 -t -s, -a <(seq 9) 1,2,3 4,5,6 7,8,9 By default "pr" fills a page of 66 lines and then starts a new page. So for files longer (in this case), 3*66, we need to set the "l" parameter to a larger number $ pr -3 -t -s, -l 1000 <(seq 270) #will print in one "page" Let n be the number of lines in the input file and ncol be the number of columns requested. The number of rows is set to [n/ncol]+1. Note that if rem(n,ncol) is not zero then the last column will be filled list. In the above case, n=270, ncol=3. Thus nrow=90 which is