Test Data file called testfile
Quote:
voice-port 0/0/0
caller-id enable
voice-port 0/0/1
caller-id enable
voice-port 0/0/2
voice-port 0/0/3
caller-id enable
voice-port 1/0/0
voice-port 1/0/1
voice-port 1/0/2
voice-port 1/0/3
voice-port 1/0/14
voice-port 1/0/15
|
Code:
sed -n '/^voice\-port /{ N; / caller/p; }' testfile
Output
Quote:
voice-port 0/0/0
caller-id enable
voice-port 0/0/1
caller-id enable
|
What Im after - voice port line, followed by caller id line.
Quote:
voice-port 0/0/0
caller-id enable
voice-port 0/0/1
caller-id enable
voice-port 0/0/3
caller-id enable
|
Its clear to me that the lines "voice followed by voice" that do not follow the pattern are creating my problem, but Im not sure how to get around that. I have the sed pocket guide and searched the web but having found anything that would help.
Thanks in advance ...