I want to print some text between two patterns which doesn't contain a particular word
input text is
HEADER asdf asd
asd COW assd
TAIL sdfsdfs
HEADER asdf asd
sdfsd DOG sdfsdfsdf
TAIL sdfsdfs
HEADER asdf asd
sdfsd MONKEY sdfsdfsdf
TAIL sdfsdfs
output needed is
HEADER asdf asd
asd COW assd
TAIL sdfsdfs
HEADER asdf asd
sdfsd MONKEY sdfsdfsdf
TAIL sdfsdfs
conceptually something like this is needed
awk '/HEADER/,!/DOG/,TAIL' text
HEADorTAILlines containDOG? If yes, is that ground for exclusion?