Bash Ripple Practice: Incident Combo
Run a two-step incident extraction and counting workflow with reproducible outputs.
Start Interactive LessonBash Ripple Practice: Incident Combo
This capstone practice combines filtering, redirection, and counting under light pressure. You isolate warning lines first, then verify incident volume in a second command.
Commands to Practice
grep 'WARN' incidents.log > warn.txt
cat warn.txt | wc -l
Expected Terminal Signal
After extraction, warn.txt should contain only warning lines. Counting the file should return:
2
Why This Matters
Incident triage often needs a fast answer to two questions: "which lines matter?" and "how many are there?" This pattern answers both with minimal command overhead.
Common Mistakes
- Filtering without saving output, forcing rework.
- Counting the wrong file after extraction.
- Ignoring case/keyword conventions in the source log.
Practice Extension
Add a second filtered report:
grep 'ERROR' incidents.log > error.txt
cat error.txt | wc -l
By repeating the same pattern with different severities, you build a reusable triage toolkit.
References
These Microsoft Learn and Windows documentation links provide authoritative details for the commands used in this article.