Quantcast
Channel: How to select first occurrence from between two patterns including them - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 3 View Live

Answer by Ed Morton for How to select first occurrence from between two...

In your final awk scipt change: p ; /!/{exit} to p {print; if (/!/) exit} so you exit after processing the block you're interested in rather than exiting at the end of the first block in the file.

View Article



Answer by Philippos for How to select first occurrence from between two...

Your first sed example doesn't work for the second and following blocks, because /!/q (the backslash may lead to undefined behaviour, so I drop it) is already executed for the first ! and the script...

View Article

How to select first occurrence from between two patterns including them

What I have: interface GigabitEthernet0/2/1/6.2061 description --> Some description here service-policy input BESTEFFORT-IN service-policy output Egress_30M vrf VPN-s2s ipv4 mtu 1500 ipv4 address...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images