我的目标是,为Fedora或红外带包裹提供正确的包装名称和包装版本(包括释放号码):
python39-3.9.16-1.module+el8.8.0+18968+3d7b19f0.1.x86_64
python3.11-3.11.2-2.el9_2.2.aarch64
glibc-2.34-60.el9.aarch64
glib2-2.68.4-6.el9.aarch64
langpacks-core-font-en-3.0-16.el9.noarch
p11-kit-trust-0.24.1-2.el9.aarch64
tzdata-2023c-1.el9.noarch
预期结果:
pkg: python39 version: 3.9.16-1
pkg: python3.11 version: 3.11.2-2
pkg: glibc version: 2.34-60
pkg: glib2 version: 2.68.4-6
pkg: langpacks-core-font-en version: 3.0-16
pkg: p11-kit-trust: version: 0.24.1-2
pkg: tzdata version: 2023c-1
我在此试图:
echo -e "python39-3.9.16-1.module+el8.8.0+18968+3d7b19f0.1.x86_64
python3.11-3.11.2-2.el9_2.2.aarch64
glibc-2.34-60.el9.aarch64
glib2-2.68.4-6.el9.aarch64
langpacks-core-font-en-3.0-16.el9.noarch
p11-kit-trust-0.24.1-2.el9.aarch64
tzdata-2023c-1.el9.noarch" > pkgs.txt
cat pkgs.txt | sed -E s/([^-]*)-([0-9]+(.[0-9]+)*(-[0-9]+)?)([^0-9].*)?/pkg: 1 version: 2/
i m 正在:
pkg: python39 version: 3.9.16-1
pkg: python3.11 version: 3.11.2-2
pkg: glibc version: 2.34-60
pkg: glib2 version: 2.68.4-6
langpacks-core-font-pkg: en version: 3.0-16
p11-kit-pkg: trust version: 0.24.1-2
pkg: tzdata version: 2023
请帮助我确定/改进定期表达,以正确划分包装名称和包装版本
UPDATE
I m going to execute this command in a container with minimum installed OS packages (similar to ubi-minimal
). So I won t have perl
and python
installed, just a minimum set of commands like: cat
, sed
, awk
, grep
, etc.