Search for optional patterns with grep OR

Bonnie Eisenman
InstructorBonnie Eisenman

Share this video with your friends

Send Tweet
Published 5 years ago
Updated 3 years ago

Describe optional patterns with grep OR using the vertical bar character |. By using the | special character, you can write either-or style patterns. In this lesson we'll look for matches on "grey" or "gray". Like the + and ? characters, the | character is part of extended regular expressions with grep, so you'll either need to escape it with a backslash, or use the -E flag.