     ROT(1)                             UNIX                              ROT(1)
                                       public

     NAME
          rot - rotate a file

     SYNOPSIS
          rot [-rbloB] [-c c] [file]

     DESCRIPTION
          Rot rotates a file, so that lines become columns and vice versa.
          Without any options, the file will be rotated clockwise. So, from the
          input

                    abcde
                    abcd
                    abc
                    ab
                    a
                       xx xx
                    A
                    AB
                    ABC
                    ABCD
                    ABCDE

          you will get

                    AAAAA aaaaa
                    BBBB   bbbb
                    CCC     ccc
                    DD   x   dd
                    E    x    e

                         x
                         x

          Rot uses a two pass algorithm, where the first part collects the line
          length of each line in the input, and the second prints out the new
          lines, seeking through the input file.  When no file or - is given,
          rot reads from standard input.

     OPTIONS
          -r   rotate reverse (counter-clockwise)

          -b   normally, rot suppresses printing of trailing blanks in output
               lines.  This option retains them, so all blanks of the input will
               appear in the output

          -l   do only the first pass and print the number of lines and the
               length of the longest line found to standard output

          -o   change order of columns; in combination with the rotation this
               yields one more file operation (see below)

                                        - 1 -     Formatted:  September 18, 2001

     ROT(1)                             UNIX                              ROT(1)
                                       public

          -B   this is for big files; the data will be hold in temporary files
               rather than in memory; this slows down rot enormously

          -c c use c as "line"-separator, instead of the newline character

     REMARKS
          One may ask, what rot is useful for.  Think about the functionality of
          programs like cat(1), or the line oriented grep(1), cut(1), sed(1),
          sort(1), and others, when applied to a rotated file.  In conjunction
          with rot they do not longer work on lines, but columns.  For example

                    rot f | grep ... | rot -r

          is a grep on columns of the file f.

          The -o option permits you to manipulate a file in some way of
          "reflecting" it in a "diagonal" line. The following table shows the
          different effects of rot called with various options. Data
          manipulation is shown by means of the output of a file with the
          contents

                    AB
                    CD

          and a symbolic notation. R means Rotation (angle given), M means
          reflection at given mirror axis.  Combinations of two calls of rot are
          also given. (Other combinations have identical effects to one of the
          mentioned.)

                           ___________________________________
                            call            output   function

                           ___________________________________
                                              CA        R
                            rot               DB     -90 deg
                           ___________________________________
                                              BD        R
                            rot -r            AC      90 deg
                           ___________________________________
                                              DB        M
                            rot -o            CA        /
                           ___________________________________
                                              AC        M
                            rot -ro           BD        \
                           ___________________________________
                                              DC        R
                            rot | rot         BA     180 deg
                           ___________________________________
                                              AB
                            rot | rot -r      CD      (Id) *
                           ___________________________________

                                        - 2 -     Formatted:  September 18, 2001

     ROT(1)                             UNIX                              ROT(1)
                                       public

                                              BA       M **
                            rot | rot -o      DC        |
                           ___________________________________
                                              CD        M
                            rot | rot -ro     AB        -
                           ___________________________________
                           |              |        |          |
          * Note, that  rot|rot -r  (or  rot|rot|rot|rot)  is not exactly the
          null operator.  R|t must insert blanks to|keep track|of the columns.
          They may appear at the end of lines in a further run|of rot, if the -b
          option is given. |Without this option blanks from the original input
          may be lost.     |              |        |          |
                           |              |        |          |
          ** This is not the same as what is done by rev(1).  Rev does not
          retain columns!  |              |        |          |
                           |              |        |          |
          Rot knows nothing|about tab characters, use expand(1) to handle them
          correctly.       |              |        |          |
                           |              |        |          |
     FILES                 |              |        |          |
          /tmp/rot* -      |              |        |          |
               temporarily copied input, if standard input is incapable of
               seeking (pipe or terminal) (-B option only)    |
                           |              |        |          |
          /tmp/rod* -      |              |        |          |
               tempfile for|holding length|of input|lines (-B option only)
                           |              |        |          |
     SEE ALSO              |              |        |          |
          rev(1), tail(1bsd), tac(1public), expand(1), colrm(1)
                           |              |        |          |
     AUTHOR
          Martin Schmidt
          Dortmund - W. Germany
          mschmidt@exunido.uucp

                                        - 3 -     Formatted:  September 18, 2001