| Hongyi Zhao on Wed, 11 Jan 2023 09:43:17 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Fwd: Programmatically obtain a complete list of commands and keywords for updating the PARI/GP third-party IDE tools. |
---------- Forwarded message ---------
From: Hongyi Zhao <hongyi.zhao@gmail.com>
Date: Wed, Jan 11, 2023 at 4:33 PM
Subject: Re: Programmatically obtain a complete list of commands and
keywords for updating the PARI/GP third-party IDE tools.
To: Joël Bleuse <joel.bleuse@cea.fr>
On Wed, Jan 11, 2023 at 4:01 PM Joël Bleuse <joel.bleuse@cea.fr> wrote:
>
>
> Strangely, if I combine the above two sed commands into a single sed
> call, the last line will be blank in the output:
>
> werner@X10DAi:~$ echo '?*' | gp -fq | grep -v 'type RETURN' | sed -Ee
> 's/[ ]+/\n/g;/^$/d' | tail | cat -A
> znconreychar$
> znconreyconductor$
> znconreyexp$
> znconreylog$
> zncoppersmith$
> znlog$
> znorder$
> znprimroot$
> znstar$
> $
> werner@X10DAi:~$
>
> Best,
> Zhao
>
> The sed documentation states:
>
> 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:
>
> which means that one cannot expect sed to properly behave if one adds
> a command after a substitution with a semicolon separator
Thank you for pointing this out. The above documentation only exists
in info, 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
Best,
Zhao
--
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province