Chapter 25. Regular Expressions

A regular expression is a series of characters and operators used for string matching. It is used most often for string searching in one or more files. Regular expressions are used in more places than most people think.

In this chapter, we will examine the use of regular expressions and show you how to make them work to your advantage.

Overview

If you use Linux (or UNIX), you will undoubtedly use regular expressions. Although you might not use them on a daily basis, you will use them occasionally. A regular expression is not a tool itself, but is an integrated component of many Linux tools (commands).

Many of the commands you use in Linux expect regular expressions, the most famous of them being the egrep command. Scripting ...

Get Inside Linux 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.