Subject: bug#25675: Errors in gnu manual 4.3

From: bamber ward <[email-masked]>
Date: Fri, 10 Feb 2017 14:46:24 +0000

manual 4.3

Here is some errors I have found in this manual ( Well I  think that they
are errors)

\B

 $ echo "abc %-= def." | sed 's/\w/X/g'

aXbXc X%X-X=X dXeXf.X   # should \B not \w

7-12

superfluous : next in program?

7-17

# The two lines are identical. Undo the effect of the n command.

  should be N command

7-18

  # Print the first of the duplicated lines

       should be second

7-20 first script

leaves blanks at end.

Say file have final 3 blank lines. On the last line N fails, exits script
and prints out

pattern space. The following seems to correct this:

                             -----

#!/bin/sed -f

     # on empty lines, join with next

     # Note there is a star in the regexp

     :x

     $ b c # added b c

     /^\n*$/ {

     N

     bx

     }

# now, squeeze all '\n'

:c // added

 s/^\(\n\)*/\1/  # only apply to completely blank lines

~/sed/code-> sedsed -d -f ./cat_s.sed ./cat_s.txt

PATT:$

HOLD:$

COMM::x

COMM:$ b c

COMM:/^\n*$/ {

COMM:N

PATT:\n$

HOLD:$

COMM:b x

COMM:$ b c

COMM:/^\n*$/ {

COMM:N

PATT:\n\ntwo blank lines above$

HOLD:$

COMM:b x

COMM:$ b c

COMM:/^\n*$/ {

COMM::c

COMM:s/^\(\n\)*/\1/

PATT:\ntwo blank lines above$

HOLD:$

two blank lines above

PATT:apple$

HOLD:$

COMM::x

COMM:$ b c

COMM:/^\n*$/ {

COMM::c

COMM:s/^\(\n\)*/\1/

PATT:apple$

HOLD:$

apple

PATT:pear$

HOLD:$

COMM::x

COMM:$ b c

COMM:/^\n*$/ {

COMM::c

COMM:s/^\(\n\)*/\1/

PATT:pear$

HOLD:$

pear

PATT:five blank lines follow$

HOLD:$

COMM::x

COMM:$ b c

COMM:/^\n*$/ {

COMM::c

COMM:s/^\(\n\)*/\1/

PATT:five blank lines follow$

HOLD:$

five blank lines follow

PATT:$

HOLD:$

COMM::x

COMM:$ b c

COMM:/^\n*$/ {

COMM:N

PATT:\n$

HOLD:$

COMM:b x

COMM:$ b c

COMM:/^\n*$/ {

COMM:N

PATT:\n\n$

HOLD:$

COMM:b x

COMM:$ b c

COMM:/^\n*$/ {

COMM:N

PATT:\n\n\n$

HOLD:$

COMM:b x

COMM:$ b c

COMM:/^\n*$/ {

COMM:N

PATT:\n\n\n\n$

HOLD:$

COMM:b x

COMM:$ b c

COMM:/^\n*$/ {

COMM:N

PATT:\n\n\n\n\n$

HOLD:$

COMM:b x

COMM:$ b c

COMM:s/^\(\n\)*/\1/

PATT:\n$

HOLD:$

~/sed/code->

~/sed/code->

Feedback

I think that the descriptions of some of the commands leaves out essential
details.

For example:

Is it legal to follow label with a space. ( yes)

Should r and w be followed by a space ( I always put one)

Should w  be the last flag to s ( yes)

I don't like the command overview. I would prefer the full description of
each command in one place.

Best Wishes
David L Ward
Reply
Forward