I am currently working on a script to clean NIS netgroup.
What I am trying to do is compile a list of entries found in NIS netgroup, but
not in NIS hosts or passwd.
It's no problem for me to compare the list against hosts or passwd, but I'm
having extreme difficulty with compiling the list to begin with.
First and foremost, I wasn't able to ypcat netgroup since it displays as one
continuous line. In turn, I have to cat the netgroup file.
Next, the netgroup contains groupnames, usernames, hosts and domains, that are
separated by tabs, spaces and various bracket and comma entries. It's all
Example of an entry:
groupname (,username,) (,username,) (hostname,,)
Using the 'awk' command, I was able to compile 3 separate lists containing
usernames, hostnames and domainnames... but I am still stuck with a list
that contains the groupname and specific entries with the bracket and comma
I tried using 'cut' to get rid of the groupname first (because I don't need it),
but it doesn't cut uniformly for other groupname entries on the list.
Also, if I am finally able to eliminate the groupname, I need to get rid of
the brackets and commas. After that, I will need to move the entries into
one column. I don't know how to do that.
I'm trying to get the following steps.
From above example (already separated by each list):
groupname (,username,) (,username,)
* The same will apply to the other netgroup entries for hostnames and
I'm quite new to scripting, so if any scripting guru can help me out, I'd
greatly appreciate it.
Thanks a whole bunch!