in reply to Print line before match
Prints:use strict; use warnings; my $prev; while (<DATA>) { print $prev if $prev and /Northbound to/i or /Southbound to/i; $prev = $_; } __DATA__ interface POS2/1 bandwidth 155520 no ip address no ip directed-broadcast no ip proxy-arp load-interval 30 shutdown crc 16 ! interface POS2/2 description PL000000/00000000-O, NNI southbound To Somewhere fms 1111 +1111 no ip address no ip directed-broadcast no ip proxy-arp encapsulation frame-relay IETF no ip mroute-cache crc 16 frame-relay lmi-type cisco ! interface POS2/2.30 point-to-point description POS2/2.30 fr dlci=30. By VPNSC: Job Id# = 9999 ip vrf forwarding V1234:Customer ip address 192.168.254.2 255.255.255.252 no ip directed-broadcast snmp trap link-status no cdp enable frame-relay interface-dlci 30 IETF
interface POS2/2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Print line before match
by ddrew78 (Beadle) on Mar 04, 2010 at 17:02 UTC | |
|
Re^2: Print line before match
by ddrew78 (Beadle) on Mar 04, 2010 at 18:43 UTC | |
by almut (Canon) on Mar 04, 2010 at 20:04 UTC | |
by ddrew78 (Beadle) on Mar 04, 2010 at 20:27 UTC |