Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 2024 16:13:18 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 279223] sed - "a\" comand displays different results depending on use of -e option
Message-ID:  <bug-279223-227-LxFyTfoMqs@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-279223-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-279223-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D279223

--- Comment #1 from Eric <erichanskrs@gmail.com> ---
Using 13.3-RELEASE and "pkg install gsed" (version 4.9).

For the a\ command of sed(1), whether or not specifying the -e option, prod=
uces
different results.
sed ' ... ' (without the -e option) seems to be in error.

        $ cat t
        1
        2
        $ cat sed-add.sh
        #!/bin/sh
        sed '/1/a\
        -new line-' <t

        printf "\n>> sed -e '... '\n"
        sed -e '/1/a\
        -new line-' <t
        $ sh sed-add.sh
        1
        -new line-2

        >> sed -e ' ... '
        1
        -new line-
        2

Using variants with double quotes, as in:
        sed "/1/a\\
        -new line-" <t
display the same differences.

gsed behaves as FreeBSD sed -e ' ... '

I couldn't find any specific POSIX guidance at:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
but the behaviour of sed -e ' ... ' seems the correct one.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-279223-227-LxFyTfoMqs>