2.2. Combining Regular Expression Metacharacters
Now that basic regular expression metacharacters have been explained, they can be combined into more complex expressions. Each of the regular expression examples enclosed in forward slashes is the search string and is matched against each line in the text file.
Example 2.9.
Note: The line numbers are NOT part of the text file. The vertical bars mark the left and right margins. --------------------------------------------------------------- 1 |Christian Scott lives here and will put on a Christmas party.| 2 |There are around 30 to 35 people invited. | 3 |They are: | 4 | Tom| 5 |Dan | 6 | Rhonda Savage | 7 |Nicky and Kimberly. | 8 |Steve, Suzanne, Ginger and Larry. | --------------------------------------------------------------- ... |
Get UNIX® Shells by Example, Third 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.