Grep - Searching for multiple items using one command

I am performing a regular check on UNIX servers which involves logging onto UNIX servers and using the grep command to check if a GID exists in the /etc/group directory

e.g. grep 12345 /etc/group

I have five to check on each server, is there anyway I can incorporate them into one command and get an output if the group exists.

e.g. The GIDs are 12345 54321 56789 98765 12986

Try:

grep -E '12345|54321|56789|98765|12986' /etc/group

More precise is

egrep ':(12345|54321|56789|98765|12986):' /etc/group

Most precise is

awk -F: '$3~/^(12345|54321|56789|98765|12986)$/' /etc/group

Last but not least let me advertise getent :

getent group 12345 54321 56789 98765 12986