sorttbl

Usage: sorttbl [options] [-r] column [[-r] column] ...

Sorts an rdbtable on one or more columns. Each column may be sorted in normal (ascending) or reverse (descending) order. Also a column of monthnames (Jan, Apr, ...) in any case letters, may be sorted.

This operator reads an rdbtable via STDIN and writes an rdbtable via STDOUT. Options may be abbreviated. Uses the UNIX 'sort' routine.

Options:

For example, using the sample data file from the DATA section (named sample) in the following command:

        sorttbl  COUNT  TYP  <  sample
would produce:
        NAME    COUNT   TYP     AMT     OTHER   RIGHT
        6       5N      4       5N      8       8>
        Bush    44      A       133     Another This
        Hansen  44      A       23      One     Is
        Holmes  65      D       1111    On      Edge
        Perry   77      B       244     And     The
        Hart    77      D       1111    So      Right
        Jones   77      X       77      Here    On

Of course it would look better if it was piped through 'ptbl'. The command:

        sorttbl  COUNT  -r  AMT  <  sample
would produce:
        NAME    COUNT   TYP     AMT     OTHER   RIGHT
        6       5N      4       5N      8       8>
        Bush    44      A       133     Another This
        Hansen  44      A       23      One     Is
        Holmes  65      D       1111    On      Edge
        Hart    77      D       1111    So      Right
        Perry   77      B       244     And     The
        Jones   77      X       77      Here    On