Categories
Linux Mastering Development

Separate on each sed match

I’m using sed to return the lines between two different patterns [(1) <Directory>, (2) </Directory>]. For the given input file, there are multiple matches for sed, and I was wondering if it is possible to pipe each individual match.

What I’m trying to do basically:
sed -n "/ddd/,/</ddd>p" < input.conf | grep Options

...
ddd    Start of Match group #1
eee
fff
/ddd   End of Match group #1
...
ddd    Start of Match group #2
iii
yyy
/ddd   End of Match group #2

I want to check to see if each match group contains the pattern fff.

Leave a Reply

Your email address will not be published. Required fields are marked *