Sed Awk and Grep
grep (Global Regular Expression Print)
Examples:
# Find lines containing "error" in a file
grep "error" logfile.txt
# Case-insensitive search
grep -i "error" logfile.txt
# Show line numbers of matches
grep -n "error" logfile.txt
# Show lines that do NOT match
grep -v "error" logfile.txt
# Show all lines containing the word "error" (case‑insensitive) in a log file
grep -i "error" /var/log/syslog
# Count how many times "TODO" appears in source files
grep -c "TODO" *.c *.hsed (Stream Editor)
Examples
AWK
Examples
Last updated