bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42133: Error in 2nd example at www.gnu.org/software/sed/


From: James Waldby
Subject: bug#42133: Error in 2nd example at www.gnu.org/software/sed/
Date: Mon, 29 Jun 2020 17:28:59 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

The second example at https://www.gnu.org/software/sed/ is as follows:

# Example: replace every occurrence of 'hello' with 'world' on lines 10-20
$ sed '10,20s/hello/world/' input.txt > output.txt

That sed command does not do what the comment says it does.

For example, if line 10 of input.txt is `hello hello` the output for that line is `world hello`.

Perhaps add a g switch after the third slash, or alternately, change the description to something like "on each of lines 10-20, replace the first occurrence (if any) of 'hello' with 'world'" or,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]