in reply to Re: Parse backup log
in thread Parse backup log

even after the changes I am still not getting any matches on frozen? My code as it stands now is like this:
sub match { while (<IMAGES>) { if ($_ =~ /^(\s+)MVA/o) { $_ =~ s/(\s+)//o; chop; #my ($tape_id, $expiration, $date, $time, $sta +tus) = split (/ /); my ($blank, $tape_id, $expiration, $date, $tim +e, $status)=split(/\s+/); #create_entry($tape_id, $expiration, $date, $t +ime, $status) create_entry($blank, $tape_id, $expiration, $d +ate, $time, $status) if ($status eq "(FROZEN)"); #if ($status eq /FROZEN/); } } }
and i still get no matches in the html form?

Edited by theorbtwo to add code tags, and remove br tags.

Replies are listed 'Best First'.
Re: ^3 Parse backup log
by Belgarion (Chaplain) on Apr 20, 2004 at 19:56 UTC

    Wait a second. Where did the

    if ($_ =~ /^(\s+)MVA/o) {
    come from? None of your IMAGE lines begin with MVA (with or without spaces.) Your match routine looks for lines beginning with MVA before trying to do the create_entry() function. Given the input you've supplied, it will never match any lines.

    I'm pretty confused at this point.

      Sorry I only gave a snipet of the output of the command that runs at the begining of the script.....the command also spits out some stuff that I do not want matched. Check it out:
      bash-2.03$ /usr/openv/netbackup/bin/admincmd/bpmedialist -summary | mo +re ********************************************************************** +********* MEDIA SUMMARY FOR SERVER sjzbkp004 ON Tue Apr 20 13:07:59 2004 ********************************************************************** +********* ACTIVE FULL SUSPENDED FROZEN IMPORTED 159 1782 0 14 0 Number of NON-ACTIVE media that: 8 - are non-active and not written yet ST0315 (FROZEN) ST0306 (FROZEN) ST0304 (FROZEN) ST0314 (FROZEN) ST0308 (FROZEN) ST0309 (FROZEN) ST0312 (FROZEN) ST4910 (FROZEN) 93 - will expire within 1 week ST2885 expires 04/20/2004 23:31 ST6200 expires 04/20/2004 23:37 ST6221 expires 04/21/2004 23:53 ST2819 expires 04/21/2004 00:01 ST2485 expires 04/20/2004 23:44 ST6216 expires 04/21/2004 00:01
      So there are a few lines I never want matched. Sorry for the confusion.

        Do you want to match all tapes, or just the frozen ones? It would appear you only want to match frozen tapes. A match function like this:

        # # Go through each line of input and create entries for only tapes # matching the "FROZEN" status. # sub match { while (<IMAGES>) { next unless m/\(FROZEN\)/; # skip non-frozen tapes chomp; s/^\s+//; # remove any leading spaces create_entry(split(/\s+/)); } }
        would match only the frozen tapes and then run the create_entry() function for each match.