GNU bug report logs -
#49590
Error in GNU sed manual
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Dear GNU people:
The GNU sed manual seems to have an error in it.
In this section:
6.3 Multiline techniques - using D,G,H,N,P to
process multiple lines
You have this example code:
sed '/./{H;$!d} ; x ; s/^/\nSTART-->/ ; s/$/\n<--END/' input.txt
The input file you give is:
a a a aa aaa
aaaa aaaa aa
aaaa aaa aaa
bbbb bbb bbb
bb bb bbb bb
bbbbbbbb bbb
ccc ccc cccc
cccc ccccc c
cc cc cc cc
and the output promised is:
START-->
a a a aa aaa
aaaa aaaa aa
aaaa aaa aaa
<--END
START-->
bbbb bbb bbb
bb bb bbb bb
bbbbbbbb bbb
<--END
START-->
ccc ccc cccc
cccc ccccc c
cc cc cc cc
<--END
This seemed wrong to me, because as I understood it the '$' symbol should indicate the last line of the file, not merely a blank line, so I executed it on my GNU sed 4.7, and this is the output you get:
START-->
a a a aa aaa
aaaa aaaa aa
aaaa aaa aaa
bbbb bbb bbb
bb bb bbb bb
bbbbbbbb bbb
ccc ccc cccc
cccc ccccc c
cc cc cc cc
<--END
This is what I expected based on other documentation, and it is what happened.
I thought you would want to know.
God bless,
Matthew Hoffman
[Message part 2 (text/html, inline)]
This bug report was last modified 3 years and 336 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.