27.3. del.lines
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.
Shift ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access