Veritas-bu

[Veritas-bu] NB Perl scripting

2002-03-02 16:07:45
Subject: [Veritas-bu] NB Perl scripting
From: rolfcolmer AT hotmail DOT com (Rolf)
Date: Sat, 2 Mar 2002 13:07:45 -0800
This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C1C1EB.3EDC12D0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi there all,

I am quite new in doing scripts with Perl, so i would like your help.

For example i want to extract information from the bpmedialist command =
to get the label ID's and the expiration date.
When i execute the bpmedialist -mlist command i get the following.

Server Host =3D thunderbird

 id     rl  images   allocated        last updated      density  kbytes =
restores
           vimages   expiration       last read         <------- STATUS =
------->
-------------------------------------------------------------------------=
-------
MEDIA    1     16   02/03/2002 19:38  02/25/2002 08:49     4mm     16365 =
      0
               =20

Out of this information i thus want the "MEDIA" and the "02/03/2002" =
information.

I create the following script

-----------------------------

open (bpmedialist, "c:/veritas/netbackup/bin/admincmd/bpmedialist =
-mlist|") || die "cannot open file $!/n" ;

$result =3D <bpmedialist>;
@line =3D split(/\s+/, $result);
print @line[0];

-----------------------------

Now my problem is that this script only reads the first line of the =
output of the bpmedialist command, thus:
Server Host =3D thunderbird

So when executing the command print @line[0]; i get the result "Server", =
and with print @line[3]; i get the result "thunderbird".

What should i change to read the whole file into the @line and calculate =
wich fields i needs? (so i can use for example print @line[30] to =
extract the MEDIA)

Hope anybody can help me with this.

Thanks!

Rolf






------=_NextPart_000_0008_01C1C1EB.3EDC12D0
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi there all,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am quite new in doing scripts with =
Perl, so i=20
would like your help.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>For example i want to extract =
information from the=20
bpmedialist command to get the label ID's and the expiration =
date.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>When i execute the bpmedialist -mlist =
command i get=20
the following.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Server Host =3D =
thunderbird</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp; =
rl&nbsp;=20
images&nbsp;&nbsp; allocated&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
last=20
updated&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; density&nbsp; kbytes=20
restores<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

vimages&nbsp;&nbsp; expiration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last=20
read&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;------- STATUS=20
-------&gt;<BR>----------------------------------------------------------=
----------------------<BR>MEDIA&nbsp;&nbsp;&nbsp;=20
1&nbsp;&nbsp;&nbsp;&nbsp; 16&nbsp;&nbsp; 02/03/2002 19:38&nbsp; =
02/25/2002=20
08:49&nbsp;&nbsp;&nbsp;&nbsp; 4mm&nbsp;&nbsp;&nbsp;&nbsp;=20
16365&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Out of this information i thus want the =
"MEDIA" and=20
the "02/03/2002" information.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I create the following =
script</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>-----------------------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>open (bpmedialist,=20
"c:/veritas/netbackup/bin/admincmd/bpmedialist -mlist|") || die "cannot =
open=20
file $!/n" ;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>$result =3D =
&lt;bpmedialist&gt;;<BR>@line =3D=20
split(/\s+/, $result);<BR>print @line[0];<BR></FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>-----------------------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Now my problem is that this script only =
reads the=20
first line of the output of the bpmedialist command, thus:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2>Server Host =
=3D=20
thunderbird</FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So when executing the command print =
@line[0]; i get=20
the result "Server", and with print @line[3]; i get the result=20
"thunderbird".</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>What should i change to read the whole =
file into=20
the @line and calculate wich fields i needs? (so i can use for example =
print=20
@line[30] to extract the MEDIA)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Hope anybody can help me with =
this.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Rolf</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0008_01C1C1EB.3EDC12D0--

<Prev in Thread] Current Thread [Next in Thread>