RH134 — Regular expressions
Regex for searching and filtering text with grep and shell tools.
Goal
Document chapter 2 of RH134 v10.0 while studying it: use regular expressions for text search and filtering in admin tasks.
Chapter content
| Section | Topic |
|---|---|
| 2.1 | Text matching with regular expressions |
| 2.2 | Guided exercise: text matching with regular expressions |
| 2.3 | Quiz: text matching with regular expressions |
| 2.4 | Summary |
What I practice
- Basic metacharacters:
.,*,[],^,$,\. grepwith-E(ERE) and patterns for logs, config files, and command output.- Partial match vs. start/end-of-line anchors.
- Practical use in the ROL lab on real RHEL text.
Reference commands
grep -E 'pattern' file
grep -E '^root:' /etc/passwd
grep -Ev 'comment|empty' /var/log/messages
Lab notes
(Fill in after guided exercise 2.2: patterns that worked and cases that failed.)
Next step
Review quiz 2.3 on ROL and note the most useful patterns for the exam here.