vtwarrior25
vtwarrior25

Reputation: 9

How do you grep for a specific pattern between 2 lines containing another pattern

I have a notes text file that I am trying to parse via a script.

This notes file has a list of sections, each delimited by a line of equals signs.

========================

Notes here

========================

More notes

========================

I want my script to find specified text, and for each instance of that text that it finds, I want it to print the entire section, but just that section.

I have tried using grep -irnPz with (?s) in the beginning of the regex, but it doesn’t work. I have also tried sed with no luck.

Upvotes: 0

Views: 22

Answers (0)

Related Questions