terminal
Welcome to Linux Practice Terminal!
Type "help" to see available commands.
user@linux:~$
Advanced grep
Master grep flags: -n for line numbers, -v for inverse match, and -c for count.
Step 1
Review: search for "ERROR" in the log file.
Type: grep ERROR documents/log.txt
grep ERROR documents/log.txt
Step 2
Use -n flag to show line numbers with ERROR matches.
Step 3
Use -v flag to show lines that do NOT contain "ERROR".
Step 4
Use -c flag to count how many lines contain "ERROR".
Step 5
Combine -n and -i flags to search "info" case-insensitively with line numbers.
Step 6
Combine -v and -c to count lines that do NOT contain "ERROR".
Step 7
Apply -n to a different file: find "@" in contacts.txt with line numbers.
Step 8
Count how many contacts use "example" domain.