6

Grouping in grep

view full story
linux-howto

http://www.unix.com – How do you do grouping in grep? Here's how I tried it at first: Code: egrep ’qualit(y|ies)’ /usr/share/dict/words -bash: syntax error near unexpected token `(' I'm using GNUgrep, and I found this on their site. grep regular expression syntax Quote: Grouping is performed with backslashes followed by parentheses ‘\(’, ‘\)’. A backslash followed by a digit acts as a back-reference and matches the same thing as the previous grouped expression indicated by that number. For example ‘\2’ matches the second group expression. The order of group expressions (HowTos)