Hey monks! I have a question on how to sort some output so I can return the correct value. I have tried several different things, including "greping" for different words and trying to sort the output in that fashion, but the problem is based on the names of the volumes in the tape library sometimes the numbers I need to check against are on a different line. It was suggest to me to remove all the carriage returns, then somehow compare the output against the threshold of seconds. Which in this case is 1001. Let me show you the output:

Process Process Description Status + Number -------- -------------------- ---------------------------------------- +--------- 69 Backup Storage Pool Primary Pool TAPE_BACKUP, Copy Pool TAPE +_OFFSITE, Files Backed Up: 36081, Bytes Backed Up +: 27,770,282,615, Unreadable Files: 0, Un +readable Bytes: 0. Current Physical File (bytes) +: 8,409,734,275 Waiting for access to inp +ut volume 300082 (3116 seconds). Current output v +olume: 300724. + 70 Backup Storage Pool Primary Pool TAPE_BACKUP, Copy Pool TAPE +_OFFSITE, Files Backed Up: 39, Bytes Backed Up: + 330,587,389,610, Unreadable Files: 0, U +nreadable Bytes: 0. Current Physical File (bytes) +: 10,636,058,581 Current input volume: 30 +0082. Current output volume: 300412. + 71 Space Reclamation Offsite Volume(s) (storage pool TAPE_OFF +SITE), Moved Files: 8401, Moved Bytes: 851,107 +,244, Unreadable Files: 0, Unreadable Bytes: +0. Current Physical File (bytes): 4,356,81 +3 Waiting for access to input volume 300082 (1843 + seconds). Current output volume: 300351 +.

This is the output from a command ran on the AIX command line to get the current processes running in our backup utility. I need to return a value if wait seconds are above 1001. However, since the spacing of these outputs and carriage returns is dynamic based on the name of process waiting what I wrote using grep only works in certain situations and even then I am not sure I am evaluating the string correctly. I use "ge" to do that, which as I understand it, evaluates the numerical value of the string. It is my hope some awesome Monk here knows a much better and easier way of doing this, because I am stumped!!! Thank you. Also I am going to add the code I currently use at the bottom here. Which does not work as it needs too. Thanks again!!!

#!/usr/bin/perl my $rundsm = "dsmadmc -id=reports -pa=reports q proc | grep Waiting"; my @output = `$rundsm`; my $string = "Waiting call (1001"; if (@output gt $string) { print "Message: Issue Found, Alert Operators\n"; print "Statistic: 1\n"; } else { print "Message: No Issues Found\n"; print "Statistic: 0\n"; } exit 0;

In reply to Trying to sort output by Stumpd

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.