Blank lines not being squeezed

From: Fred Ma (fma_at_doe.carleton.ca)
Date: 03/26/04


Date: 26 Mar 2004 04:03:01 GMT


Hello,

I was using various methods to turn a few man pages
into compact text pages. In bash notation:

        man man | PAGER -s | col -bx >| TextFile.txt

Here, PAGER can be "more" or "less". "-s" means to
squeeze out extra blank lines so that there is at most
one "consecutive" blank line anywhere in the file. The
"col" command strips away terminal-based formatting in
this context.

It doesn't work. I've tried on solaris and cygwin.
I've narrowed it down to the "|" that follows the PAGER
command. If I just do

        man man | PAGER -s

I get nice compact text (but lots of extra blank
lines if I leave out "-s". However, if I pipe or
redirect the output to anything at all, I get extra
blank lines:

        man man | PAGER -s | head

        man man | PAGER -s | cat >| Test.txt
        head Test.txt

I looked at the PAGER man pages (basically searched
for any mention of "blank") but haven't found the
reason for this inconsistent behaviour. If anyone
knows the cause, thanks for replying.

Fred