From unknown Sat Jun 21 05:02:05 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#42133 <42133@debbugs.gnu.org> To: bug#42133 <42133@debbugs.gnu.org> Subject: Status: Error in 2nd example at www.gnu.org/software/sed/ Reply-To: bug#42133 <42133@debbugs.gnu.org> Date: Sat, 21 Jun 2025 12:02:05 +0000 retitle 42133 Error in 2nd example at www.gnu.org/software/sed/ reassign 42133 sed submitter 42133 James Waldby severity 42133 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 29 21:09:39 2020 Received: (at submit) by debbugs.gnu.org; 30 Jun 2020 01:09:39 +0000 Received: from localhost ([127.0.0.1]:49852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jq4mG-0006Mb-8q for submit@debbugs.gnu.org; Mon, 29 Jun 2020 21:09:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:41766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jq3Cy-0003tn-4B for submit@debbugs.gnu.org; Mon, 29 Jun 2020 19:29:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jq3Cx-0001JC-Tp for bug-sed@gnu.org; Mon, 29 Jun 2020 19:29:03 -0400 Received: from siwi.pair.com ([209.68.5.199]:54286) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jq3Cw-0006I6-Bh for bug-sed@gnu.org; Mon, 29 Jun 2020 19:29:03 -0400 Received: from siwi.pair.com (localhost [127.0.0.1]) by siwi.pair.com (Postfix) with ESMTP id 84BCA3F40FA for ; Mon, 29 Jun 2020 19:29:00 -0400 (EDT) Received: from [192.168.17.56] (172-221-104-128.res.spectrum.com [172.221.104.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by siwi.pair.com (Postfix) with ESMTPSA id 535583F40A0 for ; Mon, 29 Jun 2020 19:29:00 -0400 (EDT) To: bug-sed@gnu.org From: James Waldby Subject: Error in 2nd example at www.gnu.org/software/sed/ Message-ID: <9c5e4471-886a-8249-19a4-b09cc4f526f9@pat7.com> 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 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------C995A7B1B89E890D4495ACA3" Content-Language: en-US Received-SPF: none client-ip=209.68.5.199; envelope-from=j13@pat7.com; helo=siwi.pair.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/29 19:29:00 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 29 Jun 2020 21:09:35 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------C995A7B1B89E890D4495ACA3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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, --------------C995A7B1B89E890D4495ACA3 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

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,



--------------C995A7B1B89E890D4495ACA3--