Searching in Files

Grep

grep 'searchTerm' fileName.txt

Search Patterns

^dave - match lines that start with dave

dave$ - match lines that end with dave

d. - matches d and then any other letter

Flags

-A1 - get the matched line and the line after

-B2 - get the matched line and the line before

-C1 - gets the matched line and lines before and after

-i - case insensitive

-o - only print the parts that have matched the pattern