Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

THis needs to be done in UNIX: The /etc/group file defines the groups to which u

ID: 3821309 • Letter: T

Question

THis needs to be done in UNIX:

The /etc/group file defines the groups to which users belong. Its format is as followed: Group password: Group ID:Group List Group List of usernames for users who are members of the group Password is an encrypted field and will usually show "x" Group is the name of the group, shown in the group field of ls -l Write an awk script, called activity5.3-5.awk, that displays the group name and usernames of group members. Groups without members shall not be displayed. Below is a report format example. Also provide the command to run the script List of Groups and users UserID Group Name root root root, bin, daemon daemon This conclude the listing

Explanation / Answer

Content of file

#!/bin/sh
awk -F ":" 'BEGIN { print "Group Name UserId ----------- ------- " } {if( $4 != "" ) {print $1" "$4}}' /etc/group

save it in activity5.3-5.awk

run chmod +x activity5.3-5.awk

then run comand ./activity5.3-5.awk to generate output