I am having a log file which looks like this

[12/21/10 18:39:20] [OAInstall]
[INFO] Configurable value OPC_BACKUP_DIR is not available in ovconfget for backup directory.
[12/21/10 18:39:20] [OAInstall] [INFO] Creating the log file
[12/21/10 18:39:20] [OAInstall] [INFO] Successfully created the log file
[12/21/10 18:39:20] [OAInstall] [INFO] HP Operations-agent installation action selected.
[12/21/10 18:39:20] [OAInstall] [INFO] Copying HP Operations agent packages is successful
[12/21/10 18:39:20] [OAInstall] [INFO] HP Operations-agent install options are: -install -defer_configure [12/21/10 18:39:20] [oasetup] [oasetup] [INFO] Validating pre-requisites for installation on btovm465.ind.hp.com
Requirements: -------------- [ PASS ] Is user root [ PASS ] Is Operating system Linux [ PASS ] Is architecture X86 [ PASS ] Check if DCE Agent is not installed [ PASS ] 700 MB free disk space required for opt and var together Recommendations: ----------------- [ FAIL ] Check if Open motif is installed Open motif toolkit not installed, xglance functionality will be affecte d.

STATUS: All requirements are OK; at least one recommendation has failed. [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] btovm465.ind.hp.com meets all pre-requisites [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] HP Operations agent installation started on - Tue Dec 21 18:39:21 IST 2010
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Log file for the installation is at : /var/opt/OV/log/oainstall.log
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Checking if Bundle xml file /var/opt/OV/installation/standalone/OVO-Agent.xml is present
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Bundle xml file /var/opt/OV/installation/standalone/OVO-Agent.xml found
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Getting component package file names from /var/opt/OV/installation/standalone/OVO-Agent.xml file
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 1=HPOvXpl.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 2=HPOvSecCo.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 3=HPOvBbc.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 4=HPOvSecCC.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 5=HPOvCtrl.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 6=HPOvDepl.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 7=HPOvConf.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 8=HPOvPacc.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 9=HPOvPerfMI.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 10=HPOvGlanc.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 11=HPOvPerfAgt.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 12=HPOvPerlA.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 13=HPOvAgtLc.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 14=HPOvEaAgt.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Component Package xml file name 15=HPOvOpsAgt.xml
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 0=HPOvXpl.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvXpl.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvXpl.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvXpl.rpm.gz=HPOvLcore
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 0=HPOvXpl
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvXpl package version=11.00.060
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 1=HPOvSecCo.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvSecCo.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvSecCo.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvSecCo.rpm.gz=HPOvLcore
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 1=HPOvSecCo
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvSecCo package version=11.00.060
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 2=HPOvBbc.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvBbc.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvBbc.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvBbc.rpm.gz=HPOvLcore
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 2=HPOvBbc
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvBbc package version=11.00.060
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 3=HPOvSecCC.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvSecCC.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvSecCC.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvSecCC.rpm.gz=HPOvLcore
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 3=HPOvSecCC
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvSecCC package version=11.00.060
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 4=HPOvCtrl.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvCtrl.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvCtrl.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvCtrl.rpm.gz=HPOvLcore
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 4=HPOvCtrl
[12/21/10 18:39:21] [oasetup]
[oasetup] [INFO] Current HPOvCtrl package version=11.00.060 [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 5=HPOvDepl.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvDepl.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvDepl.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvDepl.rpm.gz=HPOvLcore
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 5=HPOvDepl
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvDepl package version=11.00.060
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 6=HPOvConf.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvConf.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvConf.rpm.gz=Linux [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvConf.rpm.gz=HPOvLcore [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 6=HPOvConf [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvConf package version=11.00.060 [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 7=HPOvPacc.rpm.gz
[12/21/10 18:39:21] [oasetup]
[oasetup] [INFO] Compression type of package HPOvPacc.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvPacc.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvPacc.rpm.gz=HPOvPerf
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 7=HPOvPacc
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvPacc package version=11.00.060
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 8=HPOvPerfMI.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvPerfMI.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvPerfMI.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvPerfMI.rpm.gz=HPOvPerf [12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 8=HPOvPerfMI
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Current HPOvPerfMI package version=11.00.060
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compressed Package Name 9=HPOvGlanc.rpm.gz
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Compression type of package HPOvGlanc.rpm.gz=gzip
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] os type of package HPOvGlanc.rpm.gz=Linux
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvGlanc.rpm.gz=HPOvPerf
[12/21/10 18:39:21] [oasetup] [oasetup] [INFO] Package name 9=HPOvGlanc
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Current HPOvGlanc package version=11.00.060
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compressed Package Name 10=HPOvPerfAgt.rpm.gz
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compression type of package HPOvPerfAgt.rpm.gz=gzip
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] os type of package HPOvPerfAgt.rpm.gz=Linux
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvPerfAgt.rpm.gz=HPOvPerf
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Package name 10=HPOvPerfAgt
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Current HPOvPerfAgt package version=11.00.060
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compressed Package Name 11=HPOvPerlA.rpm.gz
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compression type of package HPOvPerlA.rpm.gz=gzip
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] os type of package HPOvPerlA.rpm.gz=Linux
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvPerlA.rpm.gz=HPOvAcc
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Package name 11=HPOvPerlA
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Current HPOvPerlA package version=05.08.091
[12/21/10 18:39:22] [oasetup]
[oasetup] [INFO] Compressed Package Name 12=HPOvAgtLc.rpm.gz [12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compression type of package HPOvAgtLc.rpm.gz=gzip
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] os type of package HPOvAgtLc.rpm.gz=Linux
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvAgtLc.rpm.gz=HPOvEa
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Package name 12=HPOvAgtLc
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Current HPOvAgtLc package version=11.00.060
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compressed Package Name 13=HPOvEaAgt.rpm.gz
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compression type of package HPOvEaAgt.rpm.gz=gzip
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] os type of package HPOvEaAgt.rpm.gz=Linux
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvEaAgt.rpm.gz=HPOvEa
[12/21/10 18:39:22]
[oasetup] [oasetup] [INFO] Package name 13=HPOvEaAgt
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Current HPOvEaAgt package version=11.00.060
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compressed Package Name 14=HPOvOpsAgt.rpm.gz
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Compression type of package HPOvOpsAgt.rpm.gz=gzip
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] os type of package HPOvOpsAgt.rpm.gz=Linux
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Product descriptor of the package HPOvOpsAgt.rpm.gz=HPOvEa [12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Package name 14=HPOvOpsAgt
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Current HPOvOpsAgt package version=11.00.060
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Extracting all the packages.
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvXpl.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvSecCo.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvBbc.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvSecCC.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvCtrl.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvDepl.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvConf.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvPacc.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvPerfMI.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvGlanc.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvPerfAgt.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvPerlA.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvAgtLc.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvEaAgt.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Component package HPOvOpsAgt.rpm.gz extracted successfully
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Installing the HPOvXpl package...
[12/21/10 18:39:22] [oasetup] [oasetup] [INFO] Installing with the "rpm -i /var/opt/OV/installation/standalone/HPOvXpl.rpm" command
[12/21/10 18:39:22] [HPOvXpl] [preinstall] [INFO] Architecture check not deferred for package level, proceeding with architecture check
[12/21/10 18:39:22] [HPOvXpl] [preinstall] [INFO] Determined node architecture: x86
[12/21/10 18:39:22] [HPOvXpl] [preinstall] [INFO] Determined that the package architecture and node architecture are compatible: x86
[12/21/10 18:39:22] [HPOvXpl] [preinstall] [INFO] Determined the packages to be compatible with the node on which installation is being attempted
[12/21/10 18:39:22] [HPOvXpl] [preinstall] [INFO] /var/opt/OV found
* /opt/OV is fine, continuing. [12/21/10 18:39:23] [HPOvXpl] [preinstall] [INFO] Checking for component conflicts
[12/21/10 18:39:23] [HPOvXpl] [preinstall] [INFO] no component conflicts found
[12/21/10 18:39:23] [HPOvXpl] [preinstall] [INFO] Component not configured.Stopping Ctrl will be skipped
[12/21/10 18:39:23] [HPOvXpl] [preinstall] [INFO] Component not configured. Skipping ovtrcd stop
[12/21/10 18:39:24] [HPOvXpl] [postinstall] [INFO] Creating directories under OvInstallDir
[12/21/10 18:39:24] [HPOvXpl] [postinstall] [INFO] Directories created under OvInstallDir
[12/21/10 18:39:24] [oasetup] [oasetup] [INFO] The component package HPOvXpl installed successfully
[12/21/10 18:39:24] [oasetup] [oasetup] [INFO] Installing the HPOvSecCo package...
[12/21/10 18:39:24] [oasetup] [oasetup] [INFO] Installing with the "rpm -i /var/opt/OV/installation/standalone/HPOvSecCo.rpm" command
[12/21/10 18:39:24] [HPOvSecCo] [preinstall] [INFO] Architecture check not deferred for package level, proceeding with architecture check
[12/21/10 18:39:24] [HPOvSecCo] [preinstall] [INFO] Determined node architecture: x86
[12/21/10 18:39:24] [HPOvSecCo] [preinstall]
[INFO] Determined that the package architecture and node architecture are compatible: x86
[12/21/10 18:39:24] [HPOvSecCo] [preinstall]
[INFO] Determined the packages to be compatible with the node on which installation is being attempted
[12/21/10 18:39:24] [HPOvSecCo] [preinstall] [INFO] /var/opt/OV found
[12/21/10 18:39:24] [HPOvSecCo] [preinstall] [INFO] /opt/OV found
[12/21/10 18:39:24] [HPOvSecCo] [preinstall] [INFO] Checking whether SecCore can be installed
[12/21/10 18:39:24] [HPOvSecCo] [preinstall] [INFO] Component not configured. skipping Ctrl stop
[12/21/10 18:39:24] [oasetup] [oasetup] [INFO] The component package HPOvSecCo installed successfully

I have created a code which will give me the install time taken by each component which is somewhat liek this
#!/usr/bin/perl use Time::Local; open(file1,"/var/oalogs/oainstall.linux.log") || die("File not found") +; @data=<file1>; close(file1); @component = (HPOvXpl,HPOvSecCo,HPOvBbc,HPOvSecCC,HPOvCtrl,HPOvDepl,HP +OvConf,HPOvPacc,HPOvPerfMI,HPOvGlanc,HPOvPerfAgt,HPOvPerlA,HPOvAgtLc, +HPOvEaAgt,HPOvOpsAgt); sub install { @cmpstartinstall= grep{/Installing the $component[0] package/}@d +ata; @startime = map {/^\[(.+?)\]/;$1;} @cmpstartinstall; #print "@startime\n"; if($startime[0] =~ /^([\d]+)\/(\d+)\/(\d+)\s+(\d+):(\d+):(\d+)/) { $mon = $1; $mon--; $mday = $2; $year = $3; $hour = $4; $min = $5; $sec = $6; if($year =~ /^\d{2}$/) { $year = "20" . $year; } $cmpstart = timelocal($sec,$min,$hour,$mday,$mon,$year);# #print "$cmpstart\n"; } @cmpendinstall = grep {/The component package $component[0] inst +alled successfully/}@data; @endtime = map {/^\[(.+?)\]/;$1;} @cmpendinstall; if($endtime[0] =~ /^([\d]+)\/(\d+)\/(\d+)\s+(\d+):(\d+):(\d+)/) { $mon = $1; $mon--; $mday = $2; $year = $3; $hour = $4; $min = $5; $sec = $6; if($year =~ /^\d{2}$/) { $year = "20" . $year; } $cmpend = timelocal($sec,$min,$hour,$mday,$mon,$year);# } $diff=$cmpend-$cmpstart; print "$diff\n"; #print "@cmpendinstall\n" } install();
Can i further tweak it to reduce the coding and make it more efficient.?

In reply to Need to optimize my perl code by achak01

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.