Delete blank lines from text file

This note is for a few quick ways to delete all blank lines from a text file.

  1. sed ‘/^$/d’ file > file_new
  2. grep -v "^$" file > file_new
  3. (This is for Notepad++ users) Select all text (shortcut Ctrl+A) and then click Menu TextFX -> TextFX Edit -> Delete Blank Lines

delete blank lines in notepad++


Comments

10 responses to “Delete blank lines from text file”

Leave a Reply