Subject: bug#50361: Error in first example in documentation

From: Davide Brini <[email-masked]>
Date: Sat, 4 Sep 2021 12:26:17 +0200

On Fri, 3 Sep 2021 20:26:19 +0200, Robert Spanjaard
<[email-masked]> wrote:

> https://www.gnu.org/software/sed/manual/sed.html#Invoking-sed
>
> In 2.1, the very first example in the documentation states that...
>
> 	sed 's/hello/world/' input.txt > output.txt
>
> ... replaces ALL occurences of 'hello' to 'world in input.txt.
>
> But the g flag is missing. The provided command only replaces the FIRST
> occurence.
>

I guess it depends on how you interpret it...for the following input.txt:

----------
hello
foo
bar
hello
xxx
hello
----------

the given code does indeed replace all occurrences of "hello" to "world".
Perhaps the only thing that is needed is a slightly better wording.

--
D.