GNU bug report logs - #63813
sed bug

Previous Next

Package: sed;

Reported by: yu cuilu <yucuilu <at> gmail.com>

Date: Wed, 31 May 2023 13:25:03 UTC

Severity: normal

Full log


Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Davide Brini <dave_br <at> gmx.com>
To: bug-sed <at> gnu.org
Subject: Re: bug#63813: sed bug
Date: Wed, 31 May 2023 22:01:04 +0200
On Wed, 31 May 2023 14:58:12 +0800, yu cuilu <yucuilu <at> gmail.com> wrote:

>  missing version:
> sed (GNU sed) 4.2.2
>
> case 1: fail
>
> rm -f  ./resolv.conf;
> touch ./resolv.conf;  sed -i 'a nameserver 8.8.8.8' ./resolv.conf ; cat
> resolv.conf
>
> case 2: ok
>
> rm -f  ./resolv.conf;
> echo a > ./resolv.conf;  sed -i 'a nameserver 8.8.8.8' ./resolv.conf ; cat
> resolv.conf

This is all behaving as expected. The description for the "a" command says:

Appending text after a line

In the first example, there are no lines at all in the input, so sed has no
chance to append text after reading a line.

In the second example, the input consists of one line, after which sed can
append the specified text.

--
D.




This bug report was last modified 2 years and 16 days ago.

Previous Next


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