URI:
       tadd transpose program - numtools - perform numerical operations on vectors and matrices in unix pipes
  HTML git clone git://src.adamsgaard.dk/numtools
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 1fb885b94e493d9d36da5ddf5d2cd8fb8a99510f
   DIR parent df25f3ca6a4ccaf88f31117f4285cc16c39f526d
  HTML Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Mon, 12 Jul 2021 14:46:49 +0200
       
       add transpose program
       
       Diffstat:
         M Makefile                            |       3 ++-
         A transpose                           |      15 +++++++++++++++
         A transpose.1                         |      28 ++++++++++++++++++++++++++++
       
       3 files changed, 45 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/Makefile b/Makefile
       t@@ -14,7 +14,8 @@ SCRIPTS = \
                mean\
                min\
                rangetest\
       -        sum
       +        sum\
       +        transpose
        
        MAN1 = ${SCRIPTS:=.1}
        DOC = \
   DIR diff --git a/transpose b/transpose
       t@@ -0,0 +1,15 @@
       +#!/usr/bin/awk -f
       +{
       +        for (i = 1; i <= NF; i++)
       +                d[NR][i] = $i
       +}
       +END {
       +        for (i = 1; i <= NF; i++) {
       +                for (j = 1; j <= NR; j++) {
       +                        printf("%s", d[j][i])
       +                        if (j < NR)
       +                                printf("\t")
       +                }
       +                printf("\n")
       +        }
       +}
   DIR diff --git a/transpose.1 b/transpose.1
       t@@ -0,0 +1,28 @@
       +.Dd $Mdocdate$
       +.Dt TRANSPOSE 1
       +.Os
       +.Sh NAME
       +.Nm transpose
       +.Nd interchanges the row and column positions for each field
       +.Sh SYNOPSIS
       +.Nm
       +.Op Ar file
       +.Sh DESCRIPTION
       +.Nm
       +flips the rows and columns, effectively transposing it around the
       +diagonal axis.
       +This means that an input file with N colums and M rows is output as M
       +colums and N rows.
       +The input is
       +.Ar file
       +or standard input, if no
       +.Ar file
       +is given.
       +.Sh SEE ALSO
       +.Xr awk 1 ,
       +.Xr max 1 ,
       +.Xr mean 1 ,
       +.Xr min 1 ,
       +.Xr sum 1
       +.Sh AUTHORS
       +.An Anders Damsgaard Aq Mt anders@adamsgaard.dk