Hi

I am trying to parse a string of text from a sudoers file, what I am trying
to get out is the HOSTCLUSTER name and the hosts.

Host_Alias      HOSTCLUSTER =   host1, host2, \
                                host3, host4, \
                                host5, host6 

The first problem is I split using "=" so $hostAlias[0] contains
"Host_Alias      HOSTCLUSTER" and I just need to return the HOSTCLUSTER part
and disgard Host_Alias so I will need a regex for that.

And the second bit needs to return the hosts

I know there are no examples but I have tried numerous ways and cannot solve
this..

My Current code snippet ...

        my$sudoerFile="/home/dblackb/SUDOERS/sudoers.current";
        open (FH,"< $sudoerFile")||die "Couldn't open $sudoerFile for
reading: $!\n";
        while (<FH>){
                if ($_ =~ /^Host_Alias/){
                        my@hostAlias = split(/=/,$_);
                                REGEX HERE
                }
        }
        close (FH);


Regards
David Blackburn


********************************************************************************************
" This message contains information that may be privileged or confidential and 
is the property of the Cap Gemini Ernst & Young Group. It is intended only for 
the person to whom it is addressed. If you are not the intended recipient, you 
are not authorized to read, print, retain, copy, disseminate, distribute, or use 
this message or any part thereof. If you receive this message in error, please 
notify the sender immediately and delete all copies of this message ".
********************************************************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to