- No.
- 22
- Date
- Learning goal
- Terminal Start, lesson 10
- Level
- 3 of 3
Command of the day No. 22: grep -E '^(ERROR|WARN)'
Purpose: Finds lines that start with ERROR or WARN.
Syntax: grep -E 'pattern' file
Example:
grep -E '^(ERROR|WARN)' logs/app.log
WARN disk 85% full
ERROR database timeout
WARN slow response
ERROR payment failed Output from the simulator, as on a real Linux.
Options:
Try it in the terminal Share image
Fills in the command. Nothing runs until you press Enter.