Here\'s a sed command, works great, just on every other line (simplified for your convenience):
cat testfile.txt | sed -E "/PATTERN/,/^>/{//!d;}"