Grep
Searches input files selecting line to match patterns with
grep [opts] [re] [file]
Use \
to escape characters
Search Directory
Count number of lines with the word test in it
Some Options
Flag
Does
-o
only print matching part of line
-n
output line #s too
-r
search recursively subdirs
-i
case insensitive
-v
select the non-matching lines
-E
Use extended grep(see below)
-F
Fixed string matching(faster if not re)
-C [n]
n lines shown b4 and after match
Extended Grep
Allows you to do stuff like specific or ranges of repetitions
Not
Range
Or
Other Tools
ack, ag, git grep, ripgrep
Last updated