GNU bug report logs - #50361
Error in first example in documentation

Previous Next

Package: sed;

Reported by: Robert Spanjaard <r.spanjaard <at> arumes.com>

Date: Fri, 3 Sep 2021 19:04:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Davide Brini <dave_br <at> gmx.com>
To: Robert Spanjaard <r.spanjaard <at> arumes.com>
Cc: 50361 <at> debbugs.gnu.org
Subject: bug#50361: Error in first example in documentation
Date: Sat, 4 Sep 2021 12:26:17 +0200
On Fri, 3 Sep 2021 20:26:19 +0200, Robert Spanjaard
<r.spanjaard <at> arumes.com> 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.




This bug report was last modified 3 years and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.