Re: repair comb-quoting

"'Ruud H.G. van Tol' [email protected] [sed-users]" <[email protected]> Fri, 22 Jan 2016 17:54:40 +0100
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 2016-01-22 17:47, 'Ruud H.G. van Tol' [email protected] [sed-users] 
wrote:
> On 2016-01-22 16:42, Sven Guckes [email protected] [sed-users]
> wrote:

>> http://www.guckes.net/examples/gg.tw72.comb.txt
>
> A Perl alternative: concatenate a short line to its previous line,
> but only if it has the same prefix.
>
> perl -e'
>     my $buf= join "", <>;
>     $buf =~ s/^(>(?>(?: *>)*) )(.*)\n^\1(.{1,20})$/$1$2 $3/mg;
>     print $buf;
> ' ~/mail.txt

If there can be two short lines after another, then make the main line:

   1 while $buf =~ s/^(>(?>(?: *>)*) )(.*)\n^\1(.{1,20})$/$1$2 $3/mg;

-- Ruud