So everybody wants to know what I have been working
on.  I finally got permission to post this:

#!/usr/bin/perl -w
use strict;

my $Pixarport = 7498;
my $host = "lex";
my $Pixarfile = $Pixarport."@".$host;
my @line;
my $line;
my @features_array;
my @handles_array;
my $handles;
my $features;
my $sizeof;
my $counter = 0;
my $answer;
my $string;

LOOKING_LINES: while(@line = `cat clicenses_output`){
        foreach $line(@line){
                next unless $line =~ /\S/;
                $line =~ s/^\s+//;
                @features_array = split /\s/, $line;    #split $line
along whitespace and place into an array
                LOOKING_USERS: if ($features_array[0] eq "Users") {
                        ($features = $features_array[2]) =~ s/://;      #assign
second element into $features and remove colon
                        print "features: ".$features."\n";
                        LOOKING_HANDLES: while (@line = `cat
clicenses_output`){
                                if ($line =~ /Users/) {
                                        @features_array = split /\s/, $line;    
#split $line
along whitespace and place into an array
                                        goto LOOKING_USERS;
                                }
                                next unless $line =~ /\S/;
                                $line =~ s/^\s+//;
                                @handles_array = split /\s/, $line;     #split 
$line
along whitespace and place into an array
                                $sizeof = scalar(@handles_array);
                                if ($sizeof >= 9 && $handles_array[0] eq 
"manny"){
                                        ($handles = $handles_array[5]) =~ 
s/\),//;
#assign ninth element into $handles and remove ),
                                        print "Do you wish to remove the 
floating
license: ".$features." (Y or N)?"."\n";
                                        $string = join " ", @handles_array;
                                        print $string."\n";
                                        print "answer: ".$answer;
                                        #if ($answer =~ /^[yY]$/) {
                                        #print "lmutil lmremove -c 
".$Pixarfile." -h
".$features." ".$host." ".$Pixarport."
".$handles."\n";
                                        #}
                                } 
                        #}
                }
        }
}

At this point of time, this script doesn't completely
work.  The input it is supposed to processed looks
like this:

Feature usage info:

Users of PhotoRealistic-RenderMan:  (Total of 15
licenses issued;  Total of 11 licenses in use)

  "PhotoRealistic-RenderMan" v12.000, vendor: pixard
  floating license

    3d cell26 /dev/tty (v12.0) (lex/7498 2106), start
Fri 12/10 18:20
    3d cell2 /dev/tty (v12.0) (lex/7498 1126), start
Fri 12/10 18:07
    3d cell4 /dev/tty (v12.0) (lex/7498 6023), start
Fri 12/10 18:07
    3d cell3 /dev/tty (v12.0) (lex/7498 7207), start
Fri 12/10 18:08
    3d cell3 /dev/tty (v12.0) (lex/7498 9307), start
Fri 12/10 18:08
    3d cell4 /dev/tty (v12.0) (lex/7498 9504), start
Fri 12/10 18:09
    3d cell26 /dev/tty (v12.0) (lex/7498 933), start
Fri 12/10 18:15
    3d cell20 /dev/tty (v12.0) (lex/7498 1810), start
Fri 12/10 18:18
    3d cell20 /dev/tty (v12.0) (lex/7498 711), start
Fri 12/10 18:18
    3d cell25 /dev/tty (v12.0) (lex/7498 4306), start
Fri 12/10 18:20
    3d cell5 /dev/tty (v12.0) (lex/7498 3514), start
Fri 12/10 18:07

Users of PRMan-INTEL:  (Total of 15 licenses issued; 
Total of 11 licenses in use)

  "PRMan-INTEL" v12.000, vendor: pixard
  floating license

    3d cell26 /dev/tty (v12.0) (lex/7498 1030), start
Fri 12/10 18:20
    3d cell2 /dev/tty (v12.0) (lex/7498 1219), start
Fri 12/10 18:07
    3d cell4 /dev/tty (v12.0) (lex/7498 6121), start
Fri 12/10 18:07
    3d cell3 /dev/tty (v12.0) (lex/7498 3422), start
Fri 12/10 18:08
    3d cell3 /dev/tty (v12.0) (lex/7498 3727), start
Fri 12/10 18:08
    3d cell4 /dev/tty (v12.0) (lex/7498 2713), start
Fri 12/10 18:09
    3d cell26 /dev/tty (v12.0) (lex/7498 3824), start
Fri 12/10 18:15
    3d cell20 /dev/tty (v12.0) (lex/7498 4532), start
Fri 12/10 18:18
    3d cell20 /dev/tty (v12.0) (lex/7498 4713), start
Fri 12/10 18:18
    3d cell25 /dev/tty (v12.0) (lex/7498 6208), start
Fri 12/10 18:20
    3d cell5 /dev/tty (v12.0) (lex/7498 5912), start
Fri 12/10 18:07

Users of PRMan-INTEL-NT:  (Total of 15 licenses
issued;  Total of 0 licenses in use)

Or at least  that is a portion of it.  Basically, I
need to go though and grab the features, which are
license names such as PRMan-INTEL-NT.  Then the script
starts looking for handles until it hits Users again. 
In the line:

 manny mannymac.entityfx.com /dev/tty (v6.000)
(lex/7111 503), start Fri 12/10 12:17

503 is the handle.

Originally, this script took input directly from
<STDIN>, but now I want to use <STDIN> to process yes
or no from the user, so I am taking input from `cat
clicenses_output`.  Eventually, the latter command
will be replaced with `check_licenses`.  They produce
the same output.
This is the line giving me issues:

LOOKING_HANDLES: while (@line = `cat
clicenses_output`);

Basically, after I grab $feature I need to move to the
next element of the array @line and start looking at
each element until I hit Users again (in which case I
grab the feature and the process begins again).  So
how do I make the big jump to that next element?

=====
"I'm the last person to pretend that I'm a radio.  I'd rather go out and be a 
color television set."
-David Bowie

"Who dares wins"
-British military motto

"The freak is the norm." - "The Infernal Desire Machines of Dr. Hoffman" by 
Angela Carter

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to