GNU bug report logs -
#28140
Here is a possible bug in documentation for 4.4
Previous Next
Reported by: bamber ward <dlward134 <at> gmail.com>
Date: Fri, 18 Aug 2017 15:35:01 UTC
Severity: minor
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28140 in the body.
You can then email your comments to 28140 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-sed <at> gnu.org
:
bug#28140
; Package
sed
.
(Fri, 18 Aug 2017 15:35:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
bamber ward <dlward134 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-sed <at> gnu.org
.
(Fri, 18 Aug 2017 15:35:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-sed <at> gnu.org
:
bug#28140
; Package
sed
.
(Fri, 25 Aug 2017 15:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 28140 <at> debbugs.gnu.org (full text, mbox):
Hello,
On 18/08/17 09:34 AM, bamber ward wrote:
> 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.
Thank you for reporting this.
Indeed, the sed program does not wrap the last line ('D' does not
provide a way to loop over the last line in case it's longer than 40
characters).
> #!/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
>
> }
I wonder if the following program would suffice
(very similar to yours, but without conditional P, just to simplify the
example code in the manual).
sed -E ':x
{
N
s/\n/ /g
:y
s/(.{20,20})/\1\n/
/\n/!bx
P
s/.*\n//
ty
}'
regards,
- assaf
Information forwarded
to
bug-sed <at> gnu.org
:
bug#28140
; Package
sed
.
(Thu, 12 Oct 2017 06:32:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 28140 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
> On 18/08/17 09:34 AM, bamber ward wrote:
>> 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.
I'm thinking of the attached patch,
which replaces the overly terse (and incorrect) example
with a longer version with better comments.
Also removed second example to simplify the section.
Comments very welcomed,
- assaf
[0001-doc-fix-incorrect-line-wrapping-example.patch (text/x-patch, attachment)]
Reply sent
to
Assaf Gordon <assafgordon <at> gmail.com>
:
You have taken responsibility.
(Sun, 29 Oct 2017 03:29:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
bamber ward <dlward134 <at> gmail.com>
:
bug acknowledged by developer.
(Sun, 29 Oct 2017 03:29:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 28140-done <at> debbugs.gnu.org (full text, mbox):
On 2017-10-12 12:31 AM, Assaf Gordon wrote:
>> On 18/08/17 09:34 AM, bamber ward wrote:
>>> 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.
>
> I'm thinking of the attached patch,
> which replaces the overly terse (and incorrect) example
> with a longer version with better comments.
Push here:
https://git.savannah.gnu.org/cgit/sed.git/commit/?id=490b4997
regards,
- assaf
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 26 Nov 2017 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.