Skip to content

grep

FunctionPrint lines that match a pattern, from a page body or from stdin (pipe).
OptionsSee table below. Options can be combined.
LimitationsA bare grep with no pattern/path and no pipe reports a missing operand.
OptionMeaning
-iIgnore case
-vInvert match (lines that do not match)
-nPrefix each line with its line number
-cPrint a count of matching lines instead of the lines

Matching lines are printed one per line.

$ grep a ./page1
$ grep -n pattern ./page1
$ grep -c pattern ./page1
$ ls | grep -i page
$ ls | grep -v Draft

See help grep in the console for the same option list.