use strict; use warnings; my $prev; while () { 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 11111111 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