Hour 16. Filtering Text with Regular Expressions

The most powerful text filtering tools in UNIX are a pair of oddly named programs, awk and sed. These programs allow shell programmers to easily edit text files and filter the output of commands using regular expressions. A regular expression is compact notation for describing sets of strings.

The stream editor, sed, was created as an editor for use with shell programs. As its name implies, sed is stream oriented; input is read, modified internally, and the modified version is printed out. The input file is not changed. This chapter covers the use of sed in shell scripts. Specifically we will examine the following topics:

Chapter 17, “Filtering Text with awk,” covers ...

Get Sams Teach Yourself Shell Programming in 24 Hours, 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.