


     WC(U1)               LS-DOS 6 - Utilities 1                WC(U1)



     Name
          WC - Counts the characters, words and lines in a file.

     Syntax
          wc [ -cwlp!?h ] [ wildspec ][ :drivespec ]...
          [< file | device ] [>[>] file | device ] [ ; next command ]

     Description
          Wc reads the contents of the specified files and reports on
          the number of characters, words and lines that each file
          contains.  When more than one file is examined, a total is
          also displayed.

          Wc accepts several options.  Options are specified by single
          characters, and they may be entered in upper or lowercase.
          Options are always preceded by a hyphen (a "-").  If you are
          specifying multiple options, you can specify the options in
          any of these formats:
                -a -b -c   or   -abc   or   -a -bc   or  -ab -c

          The options are:

          -c   Displays the number of characters present in the file.

          -w   Displays the number of words present in the file.
               Words are considered to be blank- or carriage-control-
               separated groups of characters.

          -l   Displays the number of lines present in the file.  Wc
               counts the sequence 0x0d 0x0a (CR/LF) as a single line,
               but all other combinations of 0x0d and/or 0x0a are
               counted as two lines.

          -p   Output of wc is routed through the more(U1) utility.
               The screen will pause once 23 lines of text have been
               displayed.  The more(U1) prompt ("--More--") allows you
               to advance or search through the remainder of the
               output.  See the more(U1) command for additional
               information on the options that more(U1) provides.  The
               -p option is ignored if the output is redirected.

          -!   Causes wc to ignore any default settings that are
               specified in the DEFAULTS/MAD file.  Wc will also
               ignore any options that are specified to the left of
               the -! option.  Note that the DEFAULTS/MAD file is
               accessed even if the -! option is specified.

          -? or -h
               Displays the help message.






     Page 1                                             May 15th, 1993






     WC(U1)               LS-DOS 6 - Utilities 1                WC(U1)



          wildspec
               A wildspec specifies none or more files that are to be
               examined in alphabetical order.  A wildspec may contain
               none or more of the following wildcard characters:

               *     The * matches zero or more characters in the
                     specified position.  For example, the wildspec
                     A*Z will match any of the following filenames:
                                      AZ          ABZ
                                    ABCDEFGZ    ABC/XYZ
                     Note that unlike a LS-DOS/TRSDOS 6 partspec(L),
                     the filename and extension are treated as a
                     single unit.  A single * will match files with
                     and without extensions.

               %     The % matches exactly one character.  So A%C
                     matches:
                                      ABC         AXC
                     The file AC will not match the A%C pattern.

               [ ]   Ranges specify multiple characters that may
                     appear in a given position in the filenames being
                     tested.  There are two formats that can be
                     combined:
                     [abc]     These specific characters are
                               acceptable in this position in the
                               filename.  So A[BC5]D would match:
                               ABD            ACD                 A5D
                     [b-e]     The characters in this ASCII range are
                               acceptable in this position in the
                               filename.  A[E-J]X matches:
                               AEX            AFX                 AGX
                               AHX            AIX                 AJX
                               Numbers can also be included in ranges,
                               but the first value of the range must
                               always have a lower ASCII value than
                               the second value.
                     [!...]    The ! excludes all files that match
                               characters in this position.  So
                               A[!DKP]D will match all filenames that
                               start with an "A", end with a "D", and
                               the second character is any character
                               except "D", "K", or "P".

                     Combinations of ranges are also allowed.
                     A[1-3ABD]X would allow these filenames:
                                A1X         A2X         A3X
                                AAX         ABX         ADX

               Any lowercase characters in the wildspec are converted
               to uppercase before the comparison is performed.




     Page 2                                             May 15th, 1993






     WC(U1)               LS-DOS 6 - Utilities 1                WC(U1)



          :drivespec
               The drivespec specifies one or more logical drives that
               should be scanned for files that match the file
               wildspec.  The % and * will examine all enabled drives.
               A range can also be used.  For example, :[2-47] will
               search for files on drives 2, 3, 4 and 7.

               If the drivespec is not specified and a wildspec is,
               all drives are searched for files that match the file
               wildspec and all files that match will be displayed.
               So if the command wc sample/txt is used and the file
               SAMPLE/TXT exists on four different logical drives, all
               four files will be examined.


          < file | device
               If a file or device is specified, wc will read the data
               from the file or device until the end-of-file is
               detected or an error occurs.  This is known as
               redirected input.  For example, if you specify < *KI,
               characters will be read from the keyboard until <BREAK>
               is pressed.  These characters will not be echoed.

               Redirected input will override any wildspecs that are
               specified.


          >[>] file | device
               By specifying a file or device, the output is sent to
               the specified file or device instead of the display.
               This is known as redirected output.  For example, the
               command wc a*:5 > count:0 places the size information
               for a list of files from logical drive 5 with names
               that start with the letter 'a' in the file COUNT:0.  If
               >> is used, the output will be appended to any existing
               contents of the file.  Filespecs for redirection may
               not specify a password.


          ; next command
               After wc completes, the remainder of the command line
               is executed as a second command.  The command wc
               x:1;date will display the size information for the
               specified file, and then the date will be displayed.


          <SHIFT>@
               When pressed during output to the display, the output
               will pause.  Pressing any other key resumes output.
               Pressing this key is ignored when output is redirected.





     Page 3                                             May 15th, 1993






     WC(U1)               LS-DOS 6 - Utilities 1                WC(U1)



     Notes
          When the -l, -w, and -c options are used, they are position
          dependent.  The first option specified will have its value
          displayed first.  For example, if you specified -lc, the
          number of lines would be the first item displayed, followed
          by the number of characters.

          If the same option appears more than once, that information
          is displayed as many times as the option is specified, in
          the order that the options were specified.

          If the -l, -w, and -c options are not specified at all, the
          default options -lwc is used automatically.

          If wc is not able to read a file because it is password
          protected, only the character total will be displayed.  The
          fields for line and width will be marked with a "-", and an
          error message will be displayed after the filename to
          indicate what the problem was.

          Wc accepts filespecs using the "/" or "." to separate the
          filename extension.  Because of this, files with passwords
          cannot be specified.

          Wc can be run on executable and other non-ASCII files.  The
          character count will always be correct, but the word and
          line count will probably have no relevance.


     Files
          Wc reads the DEFAULTS/MAD file and uses any default options
          that are specified there.  For example, if you wanted Wc to
          display only the word count, the following entry in the
          DEFAULTS/MAD file would do this:
                      WC -W
          Options in the DEFAULTS/MAD file are ignored if the -!
          option is specified on the command line.

          You may make copies of wc with different names.  When
          examining the DEFAULTS/MAD file, the name used to invoke the
          program will be used to locate the default entries.  For
          example, if you made copies of WC/CMD and named them
          WORDS/CMD and LINES/CMD, you could add the following lines
          to the DEFAULTS/MAD file:
                      WORDS -W
                      LINES -L
          Now, when words is run, only the number of words in the file
          will be displayed, and when lines is run, it would just
          display the number of lines in the file.






     Page 4                                             May 15th, 1993






     WC(U1)               LS-DOS 6 - Utilities 1                WC(U1)



          If you need more information on wc(U1) or if you want to
          obtain the LDOS 5.3 version, please write to M.A.D.
          Software, P.O. Box 331323, Ft. Worth Texas, 76163.  Please
          include a Self-Addressed-Stamped-Envelope when requesting
          information.
          ------
          305151
















































     Page 5                                             May 15th, 1993



