Hi,
I am trying to create a report using the following syntax:
#!/bin/awk -f
#script name: users_report
BEGIN { FS=":" ; OFS="\t" ; print "User\tGID\tUser Name\tHome Dir\t"
{ print $1 , $3 , $5 , $6 }
END { print "\n End of Report \n" }
$> user_report /etc/passwd
the output of above code is as under:
User GID User Name Home Dir
jbond 500 James Bond /home/sales
pdavid 501 Pierre Davidd /home/Marketing
... so on
END of Report
now trying to change the GID number to group name from /etc/group first filed.
the output should look like this:
User GID User Name Home Dir
jbond SALES James Bond /home/sales
pdavid Market Pierre Davidd /home/Market
... so on
END of Report
Can someone help me complet this code with awk or with any other appropriate command syntax please.
Thanks in advance for your help.
Regards,
Ghazi