1. Match a pattern
grep prints every line of app.log that contains the pattern "error".
grep "error" app.logTyporithm · medium
Step 1 of 8 · intro card
Text Processing
grep prints lines matching a pattern. -i ignores case, -r recurses into directories and -n adds line numbers, -c counts matching lines, -v inverts the match, and -E enables extended regular expressions.
grep scans its input line by line and prints those that match a pattern. grep "error" app.log shows every line of the log containing the word error.
Flags shape the search: -i ignores case so warn and WARN both hit, -r recurses through a directory tree, and -n prefixes each result with its line number — grep -rn "TODO" src/ is the standard way to find every TODO in a project.
Other flags change the output or logic: -c reports a count instead of the lines, -v inverts the match to show non-matching lines, and -E turns on extended regex for patterns like alternation and grouping.
grep prints lines matching a pattern.
-i ignores case; -r recurses; -n adds line numbers.
-c counts matches; -v inverts; -E enables extended regex.
grep "error" app.log
grep -i "warn" app.log
grep -rn "TODO" src/
grep -c "200" access.log
grep -v "debug" app.logConnect each part of the code to the concept before you type.
grep prints every line of app.log that contains the pattern "error".
grep "error" app.log-i makes the match case-insensitive, so WARN and warn both match.
grep -i "warn" app.log-r searches src/ recursively and -n prefixes each match with its line number.
grep -rn "TODO" src/-c prints the number of matching lines instead of the lines themselves.
grep -c "200" access.log-v inverts the match, printing only lines that do NOT contain "debug".
grep -v "debug" app.logRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.