Skip to main content

Posts

Showing posts with the label username

Extract username from netgroup output

I have NO idea how portable this is, whether it would work in an environment other than my own, etc...  So - give it a try, let me know if you found some place it would not work and how you fixed it. This is a HACK.  Someone could do this with Perl/Python/etc... and make lightwork of the problem.  That was not a possible solution for what I was trying to do. So - I would like to automate a job to take the users who belong to a particular netgroup and apply filesystem quotas to those users.  Unfortunately, the output from a getent command is a bit difficult to simply parse. I am going to create a file with the output of the getent command (not necessary) [jradtke@cypher BashFoo]$ getent netgroup sysadmin > netgroup.sysadmin sysadmin              ( , jradtke, ) ( , usern1, )  ( , dilbert, ) Remove the name of the netgroup itself from my query [jradtke@cypher BashFoo]$ cat netgroup.sysa...