[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how far can i go with grotty?
From: |
John Gardner |
Subject: |
Re: how far can i go with grotty? |
Date: |
Mon, 27 Jul 2020 17:57:10 +1000 |
> and yet i'm confused: can you explain the benefit of it over my simple
> and working sed '/^$/d' ?
sed /^$/d will wipe empty lines wherever they're found, instead of only
removing those at the end of a document.
Many man(1) implementations deliberately "squeeze" empty lines to improve
the display of badly-written or sloppily-converted Roff code. You can see
this for yourself:
.\" test.roff
Hello
.sp 5
World
.sp 5
Now compare the output of `groff -Tutf8 ./test.roff` with man `./test.roff`.
On Mon, 27 Jul 2020 at 17:31, Marc Chantreux <eiro@phear.org> wrote:
> hello John,
>
> On Sat, Jul 25, 2020 at 02:57:13PM +1000, John Gardner wrote:
> > >
> > > also: i need "sed '/^$/q'" at the end of my filter because groff
> > > renders a lot of empty lines at the end of the output whenever i
> > > use b in my tbl format. i don't know how to remove it.
>
> > sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba'
>
> thanks for this answer, however my attempt was to remove the sed command
> itself.
>
> > sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba'
>
> i have to admit i had to split it so i can read it
>
> sed ' :a
> /^\n*$/ {
> $d
> N
> };
> /\n$/ba
> '
>
> and yet i'm confused: can you explain the benefit of it over my simple
> and working sed '/^$/d' ?
>
> regards
> marc
>