apt 按多个字段显示过滤器
apt show filter by multiple fields
我想从特定的 Debian [=30= 中获取属于特定 source 包的所有 binary 包].
apt show bla-dev
命令returns输出如下:
Package: bla-dev
Version: 1.3-2
Priority: extra
Section: libdevel
Source: bla
Maintainer: someone@someone
Installed-Size: 144 kB
Download-Size: 121 kB
APT-Sources: http://my-repo/ all/main amd64 Packages
Description: Headers
我尝试获取包含以下字段的包的所有 Package:
和 Version:
字段:
Source: bla
APT-sources: http://my-repo/
命令apt show '*-*'
显示所有包的数据,所以我认为它会有所帮助,但我真的不知道如何继续(这个命令有点重 - 长文本作为输出)
您可以在 /var/lib/apt/lists/
中 grep 浏览您的存储库的纯文本包列表元数据,它们是 world-readable:
$ grep --no-filename /var/lib/apt/lists/*golang* -e 'Package: golang'
ppa.launchpad.net_golang-amd64_Packages:Package: golang
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1.15
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1-15-doc
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1.16
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1.16-doc
...
编辑:要匹配和打印更多字段,awk 可能会更好:
awk '
/Package: golang/ { p= }
/Version: / { v= }
/Source: golang-d/ { s= }
/^$/ { if (p && s) printf("%s\t%s\n", p, v); p=v=s="" }
' /var/lib/apt/lists/*golang*
输出:
golang 2:1.17~1longsleep1
golang-any 2:1.17~1longsleep1
golang-doc 2:1.16-1longsleep1+bionic
golang-doc 2:1.17~1longsleep1
golang-go 2:1.17~1longsleep1
golang-src 2:1.17~1longsleep1
我想从特定的 Debian [=30= 中获取属于特定 source 包的所有 binary 包].
apt show bla-dev
命令returns输出如下:
Package: bla-dev
Version: 1.3-2
Priority: extra
Section: libdevel
Source: bla
Maintainer: someone@someone
Installed-Size: 144 kB
Download-Size: 121 kB
APT-Sources: http://my-repo/ all/main amd64 Packages
Description: Headers
我尝试获取包含以下字段的包的所有 Package:
和 Version:
字段:
Source: bla
APT-sources: http://my-repo/
命令apt show '*-*'
显示所有包的数据,所以我认为它会有所帮助,但我真的不知道如何继续(这个命令有点重 - 长文本作为输出)
您可以在 /var/lib/apt/lists/
中 grep 浏览您的存储库的纯文本包列表元数据,它们是 world-readable:
$ grep --no-filename /var/lib/apt/lists/*golang* -e 'Package: golang'
ppa.launchpad.net_golang-amd64_Packages:Package: golang
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1.15
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1-15-doc
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1.16
ppa.launchpad.net_golang-amd64_Packages:Package: golang-1.16-doc
...
编辑:要匹配和打印更多字段,awk 可能会更好:
awk '
/Package: golang/ { p= }
/Version: / { v= }
/Source: golang-d/ { s= }
/^$/ { if (p && s) printf("%s\t%s\n", p, v); p=v=s="" }
' /var/lib/apt/lists/*golang*
输出:
golang 2:1.17~1longsleep1
golang-any 2:1.17~1longsleep1
golang-doc 2:1.16-1longsleep1+bionic
golang-doc 2:1.17~1longsleep1
golang-go 2:1.17~1longsleep1
golang-src 2:1.17~1longsleep1