[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#49590: Error in GNU sed manual
From: |
Matthew Hoffman |
Subject: |
bug#49590: Error in GNU sed manual |
Date: |
Fri, 16 Jul 2021 00:45:07 +0000 |
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
- bug#49590: Error in GNU sed manual,
Matthew Hoffman <=