Subject: Here is a possible bug in documentation for 4.4
From: bamber ward <[email-masked]>
To: [email-masked]
Date: Fri, 18 Aug 2017 16:34:13 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

manual 4.4
section 7-8
 sed -E ':x {N ; s/\n/ /g ; s/(.{40,40})/\1\n/ ; /\n/!bx ; P ;D}'
does not work as described. Change line length , say to 5
  sed -E ':x {N ; s/\n/ /g ; s/(.{5,5})/\1\n/ ; /\n/!bx ; P ;D}'
cat line_wrap_input :
apple grape
pear peach
pomengranate

~/sed/code-> sed -E ':x {N ; s/\n/ /g ; s/(.{5,5})/\1\n/ ; /\n/!bx ; P ;
D}' \  line_wrap_input
apple
 grap
e pear peach pomengranate

~/sed/code->

This seems to work:

#!/bin/sed -rf
# line_wrap.sed (

:x
{
   N
   s/\n/ /g
   :y
   s_(.{40,40})_\1\n_
    /.{40,40}/  P
   s/.*\n//
   ty
   /\n/!bx

}

Best Wishes
David L Ward