How do I group together multiple regular expressions using grep?
-
( regex | regex | regex )
Is used to group together regular expressions.Example text file used.
$ cat textfile The big bounty Big news is here The big shake-up
We want to match different words after the word big.
$ grep -E "\<big (bounty|shake-up)" textfile The big bounty The big shake-up
© Lightnetics 2024