5

I am struggling to find this - I need to strip all empty lines which might have white space before them

The alternative is messing about in Excel - I am using TextPad

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95
Jack Kada
  • 24,474
  • 29
  • 82
  • 106

5 Answers5

9

According to this blog post on wordpress.com, it's

^[[:space:]]*$
soulmerge
  • 73,842
  • 19
  • 118
  • 155
5
^\s*$

If you've got perl-compatible regex.

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95
3

In Textpad: First find blank line: F5, then ^\s*$

Next mark 'em: in the find dialog, click the "Mark All" button. You see right-carets next to each blank line.

Then delete 'em: Select Edit->Delete ->Bookmarked Lines

3

A simple reg ex for any empty line which may contain white space is:

^[ \t]*$
Paul R
  • 208,748
  • 37
  • 389
  • 560
0

Since you want to remove the line, this will not do:

^\s*$

You need to remove the line break after the empty line:

^\s*$[\n\r]*
Kobi
  • 135,331
  • 41
  • 252
  • 292