ddrew78 has asked for the wisdom of the Perl Monks concerning the following question:
I get an error sayinggrep -B 1 -i "Northbound to" file1 > file2 grep -B 1 -i "Southbound to" file1 >> file2
Is there another way of displaying one line before either or both matches? Obviously what I'm looking for is the interface that this is on. Below is a small portion of 'file1'. Thanks for any and all ideas.grep: illegal option -- B Usage: grep -hblcnsviw pattern file . . . grep: illegal option -- B Usage: grep -hblcnsviw pattern file . . .
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print line before match
by toolic (Bishop) on Mar 04, 2010 at 14:57 UTC | |
by ddrew78 (Beadle) on Mar 04, 2010 at 17:02 UTC | |
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 | |
|
Re: Print line before match
by almut (Canon) on Mar 04, 2010 at 14:48 UTC |