title: Bash script to echo certain lines from file
body: <p>I have a large file that looks something like this:</p>
  
  <pre><code>line1
  line2
  line3;
  
  line5
  line6;
  line7
  
  line9
  line10;
  </code></pre>
  
  <p>Basically, it's a bunch of lines, some of which end in semicolons. There may or may not be empty lines after these lines with semicolons.</p>
  
  <p>I'd like to do something that seems relatively simple with this file, but I haven't been able to come up with a way to do it. I'd like to invoke a bash script that would identify those lines that end with semicolons and echo the first nonempty line after each of them.</p>
  
  <p>So, in the example above, the output would be:</p>
  
  <pre><code>line5
  line7
  </code></pre>
  
  <p>I've tried a few different ways, including looping through the whole file, using a regex to check if the current line ends in a semicolon, and toggling a boolean variable to determine if the next nonempty line should be echoed. But I haven't had any luck.</p>
  
  <p>It seems like there should be any easier way, perhaps using grep, but I can't seem to come up with it. Any ideas on a good way to implement this?</p>