Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: implement wc

Implement the wc command of Unix/Linux: Given a name of file print out the number of lines, number of words, and number of characters in the file.

Given multiple file, print out the values for each file and then print out the totals for all the files.

{% embed include file="src/examples/wc/one.txt)

{% embed include file="src/examples/wc/two.txt)

 2   5  24 one.txt
 3  11 100 two.txt
 5  16 124 total