Solaris Advanced User's Guide

grep With Multiword Strings

To find a pattern that is more than one word long, enclose the string with single or double quotation marks.

$ grep “Louisa May” extensions
Louisa May Alcott     x74236

The grep command can search for a string in groups of files. When it finds a pattern that matches in more than one file, it prints the name of the file, followed by a colon, then the line matching the pattern.

$ grep ar *
actors:Humphrey Bogart
alaska:Alaska is the largest state in the United States.
wilde:book.  Books are well written or badly written.