in reply to just another search program
What have you tried? The following may be what you want:
use strict; use warnings; my $lastIP; while (<DATA>) { print if /network name|interface name|VRID|state|primary address/i; print "$lastIP\n\n" if /Monitored circuits:/ and defined $lastIP; $lastIP = $1 if /((\d{1,3}\.){3}\d{1,3})/; }
__DATA__ Network name A Interface WEB_A ggggggggg VRID 145 State: Master XXXXXXXXXXXX Effective Priority: 200 07:09:56:04:0t:ef Primary address: 194.551.205.250 Number addresses: 1 135.51.045.242 Monitored circuits: vbgghdfgdfg Interface WEB_B ggggggggg Agggggg VRID 145 State: backup XXXXXXXXXXXX Effective Priority: 200 07:09:56:04:0t:ef Primary address: 19.51.205.20 Next advertisement: 0 Number addresses: 1 135.51.05.22 Monitored circuits: vbgghdfgdfg
Prints:
Network name A VRID 145 State: Master Primary address: 194.551.205.250 135.51.045.242 VRID 145 State: backup Primary address: 19.51.205.20 135.51.05.22
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: just another search program
by sunny (Initiate) on Feb 13, 2006 at 11:29 UTC | |
by GrandFather (Saint) on Feb 13, 2006 at 20:09 UTC | |
by sunny (Initiate) on Feb 14, 2006 at 08:18 UTC | |
by GrandFather (Saint) on Feb 14, 2006 at 10:20 UTC | |
by sunny (Initiate) on Feb 14, 2006 at 14:56 UTC | |
by sunny (Initiate) on Feb 15, 2006 at 12:59 UTC |