[Chapter 27] 27.4 Finding a Pattern Only When It's a Word
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:44:20Z

#

| Chapter 27 Searching Through Files |

## 27.4 Finding a Pattern Only When It's a Word

One very useful grep option is -w, which tells it to report a line containing the pattern only when the pattern appears as a separate word. This is just like the `\<` and `\>` (26.4) pattern-matching characters, but a lot easier to type. (Unfortunately, not all versions of grep have -w.)

- TOR

27.3 Finding Text That Doesn't Match |  | 27.5 Extended Searching for Text with egrep