kansas-city-pm-list  

Re: Question

David L. Nicol
Tue, 06 Feb 2001 11:33:56 -0800

"Kimberly C. Lanners" wrote:
> 
> Hi David,
> 
> A fellow on a list I belong to has asked the group:
> 
> Does anyone have a Perl routine they would not mind sharing that parses
> a trace route for each column?
> 
> Do you have or know of a link that he might follow to find such a routine?
> 
> Thanks,
> 
> Kim Lanners


That kind of thing is trivial in Perl.  Here is a sample line from
traceroute:

18  www.sme-net.com (209.238.46.91)  54.607 ms  58.019 ms  55.850 ms

Parsing it with C<split /\s+/> looks good at first, but when there
is trouble you get a single * instead of a /\d+\.\d+ ms/ term.  But
those are always after line number, name, (number)


How about parsing it with

($Hopcount, $Name, $routerIP, $Times) = /^ ?(\d+)\s+(\S+)\s+\(([0-9.]+)\)\s+(.+)\Z/;

What you do with the columns after that is up to you




-- 
                      David Nicol 816.235.1187 [EMAIL PROTECTED]
                      www.tmcm.com, dammit

  • Re: Question David L. Nicol