HI,

I have a text file below which is simply an output from the UNIX utility
rpcinfo:

100008    1   udp  55734   walld         program 100008 version 1 ready and
waiting
107374    1   udp  64018   rpcinfo: RPC: Timed out
100008    1   tcp  55684   sprayd       program 100008 version 1 sleeping

In the attached script, I'm extracting the lines from the file which does
NOT match the string "ready and waiting". For those lines from the rpcinfo
output which did not match "ready and waiting" string, an e-mail would be
sent out to some respective sys admin. 

In the script, I've obtained the attributes i.e. the program no, version,
protocol, port, and response via pattern matching:
$waiting[$lines]=~m/^(\d+)\s+(\d+)\s+(\w+)\s+(\d+)\s+(.*)$/;
where $waiting[lines] contains all lines not matching the string "ready and
waiting". 

However, for the case of the response having the pattern:
rpcinfo:RPC:Timed Out 
I would have to split this pattern with the ":" as the delimiter in order to
obtain the output format as below, in the e-mail content:

PROG NO VERSION PROTOCOL        PORT            SERVICE RESPONSE
107374                 1                   udp          64018
rpcinfo         Timed Out
100008                 1                   udp          55684
sprayd          sleeping

I was wondering if there are ways which I can do so in just a single pattern
matching arithmetic to obtain the attributes to correspond with the output
format above?

Any other better/more efficient ideas on performing such pattern match would
indeed be appreciated. 

Could someone kindly help me out?

Thanks

 <<file-2.ZIP>> 


Attachment: file-2.ZIP
Description: Zip compressed data

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to