Troy L Adams wrote:
> 
>  This is my first post to this list and I am in need of help..I am using
> ActivePerl on Win2K and need to parse a file of data so that I have the
> number of the folder and the users who have permissions on each folder. I am
> not worried about their level of control. I am including sample data. I am
> drawing a total blank on how to parse this...any help is greatly
> appreciated.
> 
> K:\inetpub\wwwroot\wds\pl_reports\03100069
>                 BUILTIN\Administrators    Full Control [ALL]
>                 domain\someuser        Full Control [ALL]
>                                 domain\user         Full Control [ALL]
>                 domain\otheruser      Full Control [ALL]
>                 NT AUTHORITY\SYSTEM       Full Control [ALL]
> 

It seems, the folder names starts in the file left justified,
its rights informations are in the following lines,
beginning with a tab.
Am I right ?

If so, you can try my little solution (but I didn't test it :-))

# I'd like to use a hash of lists,
# keys should be the folder names, values the lists of user
my %folder_users;

# PERMISSION_DATA should be a filehandle to your list.
my $perms = join("", (<PERMISSION_DATA>)); 

while (my ($folder, $folder_perms) = $perms =~
/(\n|\G)(\w.*\r\n)(\t.*\r\n)+) {
        my @users;
        foreach split(/\r\n/, $folder_perms) {
                my ($user) = /([^\t]+)/;
                push @users, $user;
        }
        $folder_users{$folder} = \@users;
}

Good Luck,
Andrea

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

Reply via email to