Technical article 105324

How to remove excess blank lines from a file.

OpenServer 5.0.0OpenServer 5.0.2

Written · Last revised

Problem

My text file has blank lines I would like to filter out.

Solution

It is possible to remove a long series of blank lines with the
rmb(M) command.  For instance, if you have a file "infile" that
you need to strip out blank lines, run the command:
cat output | /usr/bin/rmb > outfile
or,
/usr/bin/rmb < infile > outfile

Any series of blank lines greater than two lines in length will be reduced to two blank lines in the file "output.new".

See also

rmb(M) manual page

From the Xinuos technical article database, record 105324. Reproduced with permission. The original is at www.sco.com/ta/105324, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.