Grep

grep, Global Regular Expression Print, will search input files for a search string, and print the lines that match it.

Beginning at the first line in the file, grep copies a line into a buffer, compares it against the search string, and if the comparison passes, prints the line to the screen.

Grep will repeat this process until the file runs out of lines.

NOTE: Nowhere in this process does grep store lines, change lines, or search only a part of a line.


Basic usage

Regex usage