The parentheses allows you to use regular expressions to perform string matches, or matches to actual words. Thus you may write a search that is looking for “virtual” or “main” with...
Hello, I have two questions. I apologise if I haven't explained this properly, this is for learning/understanding how regular expressions work.
Could you explain this please;
grep "([^()]*)a" file returns any line containing a pair of parentheses that are innermost and are followed by the letter "a".
How do you do grouping in grep? Here's how I tried it at first:
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
Grouping is performed with backslashes followed by parentheses \(, \).