Hi I have this text file.
Physical interface: ge-0/0/3, Enabled, Physical link is Up
Interface index: 132, SNMP ifIndex: 504
Description: # SURVEILLANCE CAMERA #
Link-level type: Flexible-Ethernet, Media type: Copper, MTU: 9000,
LAN-PHY mode, Link-mode: Full-duplex, Speed: 1000mbps, BPDU Error: None,
.....few more lines
Physical interface: ge-0/1/0, Enabled, Physical link is Down
Interface index: 133, SNMP ifIndex: 505
Link-level type: Ethernet, Media type: Fiber, MTU: 1514, LAN-PHY mode,
Speed: 1000mbps, BPDU Error: None, MAC-REWRITE Error: None,
.....few more lines
Physical interface: ge-0/1/3, Enabled, Physical link is Up
Interface index: 136, SNMP ifIndex: 508
Description: # TO CSS_I-TN-CHNN-ENB-I099 #
Link-level type: Flexible-Ethernet, Media type: Fiber, MTU: 8000,
LAN-PHY mode, Speed: 1000mbps, BPDU Error: None, MAC-REWRITE Error: None,
... few more lines
and so on....
Now If Physical link is Up & value of MTU is 9000 then only I need to replace both the corresponding lines as.
<Pass>Physical interface: ge-0/0/3, Enabled, Physical link is Up
&
<Pass>Link-level type: Flexible-Ethernet, Media type: Fiber, MTU: 9000,
In every other situation it will be <Fail> in place of <Pass> . these values lie in different line that why I am not getting any idea of using sed or anything else..please help... here is the expected output..
<Pass>Physical interface: ge-0/0/3, Enabled, Physical link is Up
Interface index: 132, SNMP ifIndex: 504
Description: # SURVEILLANCE CAMERA #
<Pass>Link-level type: Flexible-Ethernet, Media type: Copper, MTU: 9000,
LAN-PHY mode, Link-mode: Full-duplex, Speed: 1000mbps, BPDU Error: None,
.....few more lines
<Fail>Physical interface: ge-0/1/0, Enabled, Physical link is Down
Interface index: 133, SNMP ifIndex: 505
<Fail>Link-level type: Ethernet, Media type: Fiber, MTU: 1514, LAN-PHY mode,
Speed: 1000mbps, BPDU Error: None, MAC-REWRITE Error: None,
.....few more lines
<Fail>Physical interface: ge-0/1/3, Enabled, Physical link is Up
Interface index: 136, SNMP ifIndex: 508
Description: # TO CSS_I-TN-CHNN-ENB-I099 #
<Fail>Link-level type: Flexible-Ethernet, Media type: Fiber, MTU: 8000,
LAN-PHY mode, Speed: 1000mbps, BPDU Error: None, MAC-REWRITE Error: None,
... few more lines
and so on....
sed? If yes, please, show us!