[Veritas-bu] NB Perl scripting
2002-03-02 16:07:45
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> </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> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>Server Host =3D =
thunderbird</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> id =
rl =20
images allocated =
last=20
updated density kbytes=20
restores<BR> =
vimages expiration last=20
read <------- STATUS=20
-------><BR>----------------------------------------------------------=
----------------------<BR>MEDIA =20
1 16 02/03/2002 19:38 =
02/25/2002=20
08:49 4mm =20
16365 =20
0<BR> &n=
bsp; =20
</FONT></DIV>
<DIV> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>I create the following =
script</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2>-----------------------------</FONT></DIV>
<DIV> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>$result =3D =
<bpmedialist>;<BR>@line =3D=20
split(/\s+/, $result);<BR>print @line[0];<BR></FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>-----------------------------</FONT></DIV>
<DIV> </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> </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> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>Hope anybody can help me with =
this.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks!</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Rolf</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT>
<DIV> </DIV>
<DIV> </DIV></BODY></HTML>
------=_NextPart_000_0008_01C1C1EB.3EDC12D0--
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Veritas-bu] NB Perl scripting,
Rolf <=
|
|
|