title: Remove numbered chapter titles that do not have text immediately below
body: <p>I have text files that list of 3000 to 5000 lines that I'll call numbered chapter titles.  I want to delete the rows that do not have text (sentances) immediately below the title.</p>
  <p>Like:</p>
  <pre><code>Chapter 1
  Chapter 2
  Chapter 3
  Hello world
  Chapter 4
  Chapter 5
  I love you. 
  Chapter 6
  how many times do I have to do this
  chapter 7
  Chapter 8
  Chapter 9
  Some lines have some numbers, numbers and text.
  some chapter text has multiple lines.
  I thought the best method is to
  look for a chapter header line 
  that has a chapter header line 
  immediately below it.  The last chapter 
  line becomes an issue if it does 
  not have any text.
  Chapter 10
  </code></pre>
  <p>I want to remove the lines Chapter 1, 2, 4, 7, 8 and 10</p>
  <p>I tried to match with grep and sed with a Chapter line if the following line was also a Chapter line using positive lookaheads (the lookahead would not be deleted)</p>
  <p><code>grep -Pz '(?s)Chapter\s[\d]{4}\n(?=(Chapter\s[\d]{4}\n)) filename.txt</code></p>
  <p>or in sed (I'm not understanding the scripts with sed)...</p>
  <p><code>sed 's/(?s)Chapter\s[\d]{4}\n(?=(Chapter\s[\d]{4}\n))/ /g' filename.txt</code></p>
  <p>Grep doesn't do multi-line well (everything becomes one line if you use the -Pz tags. If everything is one line, then anything that matches anywhere means the line is a match.</p>
  <p>I also tried using sed, with a look aheads  so, I cannot use look-ahead since part of the one line matched.</p>
  <p>I know I can do this with python or other scripting language but it is much too slow vs. the bash commands.  I was able to process to this level from a bigger mess very quickly vs python so I was hoping I could get to this last step with bash commands only and keep our update window much shorter.  The files are huge and there is much more random text in the chapters that have text.  It can be multiple sentednces.</p>
  <p>Cheers and thanks for any help!</p>