•Arnošt Havelka
Practical: Text Ops
Real-world scenario: Filtering logs and extracting data.
Start Interactive LessonPractical: Text Processing
In this scenario, we act as a system administrator analyzing a server log file. We need to find errors, count them, and suspect a specific user is causing trouble.
The Mission
You have a large server.log file. You need to:
- Find all "Error" entries.
- Count how many time "Timeout" occurred.
- Check if user "admin" logged in.
Step 1: Find all Errors
Use find to filter the log for lines containing "Error".
Command Prompt
C:\Users\User>find "Error" server.log
Step 2: Count Timeouts
Use find /c to count occurrences of "Timeout".
Command Prompt
C:\Users\User>find /c "Timeout" server.log
Step 3: Search for User Login
Use findstr to look for a specific pattern.
Command Prompt
C:\Users\User>findstr "Login.*admin" server.log
Step 4: Extract Errors to a separate file
Save your findings for a report.
Command Prompt
C:\Users\User>find "Error" server.log > error_report.txt
Knowledge Check
1 / 2Which command would you use to simple count matching lines?