This script came about because the developers kept asking me ‘what was that sed command to delete blank lines again?’ I decided I would knock up a little script for them to use, which would save them the trouble of ringing me up for the command.
The script is really a wrapper for the sed delete command, but it keeps the developers happy, and it gets used a lot.
Shell scripts do not have to be long. If a task can be automated and it saves you time, script it.
del.lines can take a single file or multiple files. Each file is checked for its presence before sed does the work of deleting all blank lines. The output of sed is directed to a temporary file using $$, and the file is then moved back to replace the original file.