How to Remove Blank Lines From a Text File

by Jason Artman
Text files can appear to have formatting issues when viewed in a different editor.

Text files can appear to have formatting issues when viewed in a different editor.

keyboard image by Fyerne from Fotolia.com

If you receive a text file created in a text editor other than the one that you use, you may find that the file has certain formatting issues such as extra blank lines. This can make the file difficult to read and inappropriate for distribution to someone else. However, several free utilities exist to remove blank lines from text files. Remove blank lines from a text file using a Web-based utility or a downloadable one.

Removing Blank Lines with a Web-based Tool

Step 1

Browse to either My Text Tools or Bo Allen website and open the text file from which you want to remove blank lines using the text editor of your choice.

Step 2

Click inside the text editor to place a cursor somewhere in the text file, then press the "Ctrl-A" keys simultaneously to highlight the entire file.

Step 3

Press the "Ctrl-X" keys simultaneously to cut the file to the Windows clipboard.

Step 4

Click in the text entry box for the Web-based tool you have selected and press the "Ctrl-V" keys simultaneously to paste the text file into the box.

Step 5

Click the "Remove Empty Lines" or "Remove Blank Lines" button. The blank lines are removed from the file.

Step 6

Highlight the text in the box, cut it to the Windows clipboard and paste it back into the text editor using the keyboard shortcuts described in this article, then save the file.

Removing Blank Lines with a Standalone Utility

Step 1

Download the Remove Blank Lines utility and install and launch it.

Step 2

Select the radio button labeled "Backup files then delete blank lines in input files." This causes the utility to modify the text file only after creating a backup to ensure the original data are retained in the event of a problem.

Step 3

Click "Open and fix files."

Step 4

Browse to the location of the file from which you want to remove the blank lines and double-click it. A backup file is created in the same location with the prefix "Copy of." All blank lines are removed from the original file.

About the Author

Jason Artman has been a technical writer since entering the field in 1999 while attending Michigan State University. Artman has published numerous articles for various websites, covering a diverse array of computer-related topics including hardware, software, games and gadgets.

Photo Credits