7. Manipulating Text Files with Filters

The commands in this chapter are all filters. A filter takes in input, often via standard input, processes it, and then writes the results to standard output. You will often find pipes in the midst to help move the input and output along, from filter to filter, forming a pipeline (see Chapter 5, “Building Blocks,” for stdin, stdout, and pipes).

This chapter looks at wc, nl, cut, sort, uniq, tr, sed, and awk. For a longer list of UNIX filters, check out Wikipedia’s article at https://en.wikipedia.org/wiki/Filter_(software). Most of the commands in that list are discussed in this book. Besides this chapter, you can find tee in Chapter 5; cat, head, less, more, tac, and tail in Chapter 6, “Viewing (Mostly ...

Get Linux Phrasebook, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.