Linux: Listing users belonging to a specific group

I have a discovery script that I run on Linux servers to collect configuration files and other information. I use the resulting output to write reports offline. The script also collects the .bash_profile and ssh configuration files for each Oracle user (which vary from site to site). Up to now I have been customizing the scripts on site, but I have now found a better way to identify Oracle users.

In most environments, all Oracle users (grid, oracle etc) belong to the oinstall operating system group. Therefore all I need is a list of users belonging to this group. I could use awk or perl to extract this information, but I would need to inspect both /etc/passwd and /etc/group which seems a lot of effort.

However, there is a utility called lid (/usr/sbin/lid) in RHEL5 and OEL5 (at least) which can be used for this purpose.

By default lid displays information about the groups to which a specific user belongs. It can also display a list of users belonging to a specific group (which is the functionality that I require).

lid takes a couple of options; -g to list users in a specified group and -n to output names only (no UIDs or GIDs).

So I can obtain my list of Oracle users using:

/usr/sbin/lid -g oinstall -n
For example:
[oracle@server14] $ /usr/sbin/lid -g oinstall -n 
grid
oracle
oraclea
oracleb
oraclec

I can use the resulting list to identify files to be collected.