music
OSdata.com: programming text book 

OSdata.com

wc

summary

    This subchapter looks at wc, a UNIX (and Linux) command.

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

wc

    This subchapter looks at wc, a UNIX (and Linux) command.

    wc is used to count lines, characters, and words in a file.

word count command

    Use the wc command to count the number of words in your file.

    $ wc names
           6       6      38 names
    $

    The format is the number of lines (6), followed by the number of words (6), followed by the number of characters (38), followed by the name of the file (names).

multiple files

    You can use the wc command with several file names.

    $ wc names file01.txt
           6       6      38 names
           9      29     134 file01.txt
          15      35     172 total
    $

    The output gives the results for each file (in the order they were listed in the command) and a final line with the totals for al of the files combined.

count the number of lines

    Use the wc command with the -l option to count the number of lines in your file.

    $ wc -l names
           6 names
    $

    The output is the number of lines and the name of the file.

count the number of words

    Use the wc command with the -w option to count the number of words in your file.

    $ wc -w names
           6 names
    $

    The output is the number of words and the name of the file.

count the number of characters

    Use the wc command with the -m or -c option to count the number of characters in your file.

    Solaris and HP-UX use -m.

    Linux uses -c.

    Mac OS X accepts both -m and -c.

    $ wc -c names
           38 names
    $

    The output is the number of characters and the name of the file.

multiple options

    You can use multiple options in a single command. The order does not matter. For example, all of the following variations will count the number of lines and words:

    $ wc -l -w filename

    $ wc -w -l filename

    $ wc -lw filename

    $ wc -wl filename


comments, suggestions, corrections, criticisms

please contact us

your name:
email address:
phone number:
message:

free music player coding example

    Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming).


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

previous page next page
previous page next page

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


Google


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    †UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2012, 2013 Milo

    Created: September 2, 2013

    Last Updated: August 6, 2013


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

previous page next page
previous page next page