Remove empty lines with SED « Rforge

To remove excess text in the datasheets makes it possible to rerun the procedure or track systematic errors.

Removing empty lines from a file containing code in plain text (like .csv, .html, .php, etc…) is very easy with SED in a UNIX/ MAC OS shell and even possible in the Windows CMD (after installing SED).


Remove Blank Lines With Sed - Bookshelf

Linux Command Line and Shell Scripting Bible

Linux Command Line and Shell Scripting Bible

Deleting lines Another useful utility for the sed editor is removing unwanted blank lines in a data stream. It's easy to remove all the blank lines from a ...

Sed & awk

Sed & awk

We find that when we begin to tackle a problem using sed, we do best if we make a mental ... Remove multiple blank spaces that were added between words. ...

Sed, A Stream Editor

Sed, A Stream Editor

bz # all empty lines were deleted/ignored, but we have a non empty. ... The posix standard specifies that conforming sed implementations shall support at ...

UNIX power tools

UNIX power tools

Only when there was an odd number of blank lines was a single blank line preserved. That is because the delete command clears the entire pattern space. ...

Portable shell programming, an extensive collection of bourne shell examples

Portable shell programming, an extensive collection of bourne shell examples

Notice that a line that contains spaces or tabs is not empty. sed -e '/A$/d' ... The following command will delete empty lines or lines that contain only ...

Helpful Information Directory


Fedora Linux Legacy Blog: remove blank lines using grep or sed
A SysAd Linux Blog covering linux tips, linux howtos, linux installation, linux tutorials, ... This entry covers how to remove blank lines of text files using sed and grep. ...

Howto: Linux command line utilities for removing blank lines ...
Explains how to use sed command to remove all blank lines from a text file under Linux or UNIX systems.

sed tip: Remove / Delete All Leading Blank Spaces / Tabs ...
Use sed command to delete / remove BOTH leading and trailing whitespace from each line including blank lines from a text file.

blank lines and sed
-hello, i have tried to remove blank lines from a file using korn shell script file.. it doesn't seem to work! i tried sed '/^\s*$/d' infile > outfile b...

How To Remove Blank Lines from a File
If you want to remove all blank lines from a file, a quick way of doing it from the Linux command line is to use sed. So, lets say that your file looks like this: ...