Solaris Advanced User's Guide

Searching for Lines Without a Certain String

To search for all the lines of a file that do not contain a certain string, use the -v option to grep. The following example shows how to search through all the files in the current directory for lines that do not contain the letter e.


$ ls
actors    alaska    hinterland    tutors    wilde
$ grep -v e *
actors:Mon Mar 14 10:00 PST 1936
wilde:That is all.
$