Solaris ユーザーズガイド (上級編)

複数ワード文字列の検索

複数のワードからなるパターンを grep で検索する場合は、単一引用符または二重引用符でそのパターンを囲みます。


$ grep “Louisa May” extensions

Louisa May Alcott     x74236

$

grep コマンドは、複数のファイル内で文字列を検索できます。複数のファイル内でパターンに一致する文字列が見つかった場合は、ファイル名とパターンに一致する行をコロンで区切って出力します。


$ grep ar *

actors:Humphrey Bogart

alaska:Alaska is the largest state in the United States.

wilde:book.  Books are well written or badly written.

$