Counting the number of lines, words, and characters from a text file are very useful for text manipulations. In several cases, these counts are used in indirect ways to perform some hacks in order to produce the required output patterns and results. This book includes some tricky examples in other chapters. Counting LOC (Lines of Code) is a very important application for developers. We may need to count special types of files excluding unnecessary files. A combination of wc
with other commands help to perform that.
wc
is the utility used for counting. It stands for word count
. Let us see how to use wc
to count lines, words, and characters.