Title: grep Command
Course: CIS 121: Linux/UNIX I: Fundamentals ~ For IGNITE Review > Section: Learning Modules

The grep filter is famous among Unix users. The most common use of grep is to filter lines of text containing (or not containing) a certain pattern.

NOTE: Only search for alpha-numeric characters, for now. Special characters will create unexpected results.

grep -i

One of the most useful options of grep is grep -i which filters in a case insensitive way. Grep without the -i option will only find a match if the case of the pattern matches exactly with the case in the file.

grep -v

Another very useful option is grep -v which outputs lines with no match for the pattern.

[paul@RHEL4b pipes]$ grep -v Fra tennis.txt
Kim Clijsters, BEL
Justine Henin, Bel
Serena Williams, usa
Venus Williams, USA

(Cobbaut, p. 124-125)