P.S. Based on the discussion here [1], the reason for the problem here is explained in the info of sed, but not in man:
werner@X10DAi:~$ sed --version |head -3
sed (GNU sed) 4.8
Packaged by Debian
Copyright (C) 2020 Free Software Foundation, Inc.
werner@X10DAi:~$ info sed |grep -A5 -i 'In a substitution command'
In a substitution command, the 'w' flag writes the substitution
result to a file, and the 'e' flag executes the subsitution result
as a shell command. As with the 'r/R/w/W/e' commands, these must
be terminated with a newline. If whitespace, comments or
semicolons are found, they will be included in the shell command or
filename, leading to unexpected results:
werner@X10DAi:~$ man sed |grep -i 'In a substitution command'
werner@X10DAi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.10
Release: 22.10
Codename: kinetic
[1]
http://pari.math.u-bordeaux.fr/archives/pari-users-2301/msg00049.html
Best,
Zhao