SORT    Used to "FILTER" data contained in a file and
        DISPLAY it on the screen in a rearranged format
        (Format 1); to create a new file that contains
        the same data as another file, only in SORTED
        order (Format 2); or to display the output of
        another command in a SORTed format when used
        as a "PIPE" (Format 3).

Format: 1) SORT <[D:Path]FileSpec [/R] [/+Col]

        2) SORT <[D:Path]SFile >[D:Path]DFile [/R][/+C]

        3) COMMAND [Para] | SORT [/R] [/+Col]


  /R   sorts in REVERSE alphabetical order

  /+Col  causes the sorting to be based on the COLUMN
         number specified.

Example:          SORT < PHONES.TXT

   Displays the contents of the PHONES.TXT file in the
   CURRENT directory in alpha-order on your screen.


Example:        SORT < \NOTES\PHONES.TXT /R

   Displays the contents of the PHONES.TXT file in the
   \NOTES directory on the CURRENT drive in REVERSE
   alpha-order on your screen.


Example:       SORT < PHONES.TXT > PHONES.SRT /+35

   Creates a new file named PHONE.SRT that contains the
   same data as is in the source file named PHONES.TXT,
   except the data is now in alpha-order based on the
   character in column 35. (e.,g,. character 35 is the
   beginning of the area code in the PHONE.TXT file.)



Example:             DIR | SORT

   Displays directory listing of the CURRENT directory
   that is sorted in alphabetical order.


Example:         DIR \WP\*.TXT | SORT /+25

   Displays a directory listing of the \WP\*.TXT files
   on the current drive that is sorted in alphabetical
   order by file creation date.


Example:       DIR D:\WP | SORT /+9 >LPT1

   Sorts the \WP directory on drive D: according to
   file extension (col 9) and sends the output directly
   to your printer where it is immediately printed. (An
   example of both PIPING "|" and REDIRECTION ">" in a
   single operation!)

Example:      DIR D:\WP | SORT >WPSORT.LST

   Same as above, except directory is sorted according
   to file name and the output is REDIRECTED to a NEW
   file named WPSORT.LST in the CURRENT directory. This
   file can later be displayed on the screen using the
   TYPE command or be printed using the COPY command
   with the >LPT1 redirection parameter.

[*]  NEVER issued the SORT command WITHOUT specifying
   parameters. A command of just "SORT" all by itself
   will cause your computer to enter an endless loop.
   If this accidentally happens, IMMEDIATELY shut-down
   the system by either turning it off at the power
   source or by using the "Alt-Ctrl-Del" sequence to
   reset the system.

[*]  The sophisticated manipulations of file contents
   you can perform using a combination of FILTERING,
   REDIRECTION and PIPING is almost endless. Using the
   basic formats and examples contained herein should
   provide you with an understanding of how these
   basic techniques work; and with a little "creative"
   thinking and experimentation, you will begin to get
   a real appreciation of just how "POWERFUL" the world
   of DOS really is!
