awk '/begin/{s=""}{s=s ? s ORS $0:$0}/end/{if(s~/pattern1/)print s RS}'
Glad to know that it worked for you..
So here is details
/begin/{s=""} --> Search keyword begin, if keyword found then empty variable s s=""
{s=s ? s ORS $0:$0} --> append currennt line to variable s with ORS (output record separator) if s is not empty, if variable s is empty then s = current line , default value of ORS is the string "\n" ; i.e., a newline character
/end/ --> So now search for end keyword, if end is found, then check for pattern1
if(s~/pattern1/)print s RS --> check whether variable s we used above contains pattern1, if condition is true print variable s and Record Separator (RS).