Text Tools
With the jack-of-all-trades sed, you can certainly master any kind of text manipulation, but the result is often complex and hard-to-remember syntax. The helpers presented in this article replace or enhance sed for many smaller text editing tasks.
Many small programs can help you with your "word tasks" in the shell. Table 1 shows an overview of which ones to use. Unless indicated otherwise, they work with single or multiple files as well as pipe operations. Some applications overlap in their functionality.
To follow along with the examples shown in this article, you can grab the files a.txt
, b.txt
, c.txt
, d.txt
, and e.txt
from our FTP server [1].
Showing, Piping, and
Merging
The cat
and tac
tools differ mainly by the output order of the content: cat
puts the file in its original order, and tac
reverses the order. The scope of their options is also different (see Table 2). You can also add line numbers using cat
(Figure 1), including blank lines.
[...]
Use Express-Checkout link below to read the full article (PDF).