>_ IzzyLab

Topic breakdown

A blank line in regex terms is a position where the start anchor ^ sits right up against the end anchor $ with not a single character between them. A line of only spaces does not fit this definition — it is non-empty, and if those need to go too, the pattern is extended with a whitespace class. Matching lines can be removed two ways: by inverting matches in grep (keep everything that did NOT match) or with a delete-by-pattern-address command in sed. The ^ and $ anchors work the same in BRE and ERE, so -E mode is not needed here.

What's checked

  1. No blank lines
  2. All non-empty lines kept

What it looks like