I would like to use either awk, sed, or grep to match a regex, but print not only line that contains the match, but also those lines before and after that match until a line that begins with a certain character.
So, for example, in the input above, if I would like to match the pattern "BVX" in field 2, I would desire the output to include not only that line, but also those between the nearest two lines before and after beginning with "*".
This is a very long file where a given pattern (such as "BVX" in the example) can occur multiple times. I would like to print each match of "BVX" and the lines before it stopping at /^\*/ and after the match stopping at /^\*/.
I have attempted combinations of grep and sed, but to no avail, e.g.