Interpret PATTERN as an extended regular expression
You want to search using a fancy expression. For example parenthesis () can be used to indicate groups with | used as an OR operator.
You could run this search using -E:
grep -E ‘^no(fork|group)’ /etc/group
…to return lines that start with either “nofork” or “nogroup”.
Without the -E switch you would have to escape the special characters involved because with normal pattern matching they would just
search for that exact pattern;
grep ‘^no\(fork\|group\)’ /etc/group
You have a file with a list of say ten Unix usernames in plain text.
You want to search the group file on your machine to see if any of the ten users listed are in any special groups:
grep -F -f user_list.txt /etc/group