Working with Text Files
The Unix philosophy started by Ken Thompson aimed to create a capable operating system with a small footprint and a clean user interface. Because part of the Unix philosophy is to write programs to handle text streams, because that is a universal interface, communication between programs, configuration files, and many other things is implemented in plain text. This section is all about handling plain text.
Reading Text
On the most fundamental level, reading the content of a file in plain text format means taking the content of this file and redirecting it to the standard output. The cat
command is one utility that can do that—concatenate the content of one or more files (or another input channel) to the standard output:
Figure 3.10: Using the cat command to generate standard output
Some nice parameters of this utility are:
-A
: Show all non-printable characters-b
: Number lines, including empty lines
...