>
>
> I'm just new to Perl and have no idea where to start with the task that I have to 
>complete.  Any help would be appreciated.
>
> Currently when a particular .exe is run, the following is displayed in the command 
>window -
>
> License server on host "kronos".
> Running since Monday 4/04/96 15:53:13.
>
> LICENSES:
>  Max-Users       Expires       Password [status]
>     19           none          2aae4b60.b4ac4f0f.02 [Valid]
>
>  Maximum active users allowed: 19
>  Current active users: 6
>  Available licenses: 13
>
> ACTIVE users:
>     User            Priority           Time-out in
>     rdc                 2              59 minutes (at 10:44:20)
>     chris               1              26 minutes (at 10:10:45)
>     cheryl           none              23 minutes (at 10:07:27)
>
> License Usage Statistics:
> 2 licenses revoked today 4/14/96.
> 0 license requests denied.
> 0 active users bumped by preferred user.
>
> >From this i need to extract "just" the user names and place them into an external 
>file.  How do I go about this?
>

Give this a try
#!/usr/local/bin/perl -w
use strict;
my $seen_user;
open (EXE_OUT, "<your exe name> |") or die "Exe execution failed : $!\n";
while (<EXE_OUT>) {
        $seen_user = 0 if ($seen_user && m/^$/);
        $seen_user = 1, <EXE_OUT>, next if (m/^ACTIVE users:/);
        #Use ACTIVE users: as a marker, read out the next line containing the headers 
and next
        s/^\s+//, (print "user is ", (split (/\s+/))[0], "\n") if ($seen_user);
        #Remove the leading white spaces and split, index 0 is the user name
}
close (EXE_OUT);



>
> Thanks heaps
> Melissa


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

Reply via email to