我想获得9999
我的 Gentoo Linux 系统上所有实时(即版本)软件包的列表。这些包含在(动态生成的)@live-rebuild
包集中。
我可以通过运行将它们打印到屏幕上emerge -pav @live-rebuild
;但这也给了我很多其他细节和语法:
zenbookhost ~ # emerge -pav @live-rebuild
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R *] sci-libs/nipy-9999::neurogentoo PYTHON_TARGETS="python2_7 python3_4 -python3_5" 0 KiB
[ebuild R *] app-misc/repositorg-9999::chymeric PYTHON_TARGETS="python2_7" 0 KiB
[ebuild R ] dev-python/yahoo-finance-9999::chymeric USE="{-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5" 0 KiB
[ebuild R *] sci-biology/ants-9999::neurogentoo 0 KiB
[ebuild R *] sci-libs/labbookdb-9999::chymeric PYTHON_TARGETS="python2_7 python3_4 -python3_5" 0 KiB
[ebuild R *] dev-python/matrix2latex-9999::neurogentoo PYTHON_TARGETS="python2_7 python3_4" 0 KiB
[ebuild R *] dev-python/tqdm-9999::gentoo PYTHON_TARGETS="python2_7 python3_4 -python3_5" 0 KiB
[ebuild R *] sci-biology/psychopy-9999::neurogentoo PYTHON_TARGETS="python2_7" 0 KiB
[ebuild R *] sci-biology/nilearn-9999::neurogentoo USE="plot {-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5" 0 KiB
[ebuild R *] sci-biology/dcmstack-9999::neurogentoo USE="{-test}" PYTHON_TARGETS="python2_7 python3_4 -python3_5" 0 KiB
[ebuild R *] sci-visualization/mricron-9999::neurogentoo 0 KiB
Total: 11 packages (11 reinstalls), Size of downloads: 0 KiB
有什么方法可以只获取category/package
名称 - 就像我通过运行那样cat /var/lib/portage/world
?对于上面的情况是:
sci-libs/nipy
app-misc/repositorg
等等。
理想情况下,我会寻找命令的参数emerge
,它只返回包名称,或保存这些集的一些文件(例如/var/lib/portage/world
)。
答案1
如果你有,GNU grep
你可以使用它的-P
标志PCRE mode
对于-o
仅匹配模式,
emerge -pav @live-rebuild | grep -Po "\[.*\]\s\K[a-zA-Z0-9-]*\/[a-zA-Z]*"
sci-libs/nipy
app-misc/repositorg
dev-python/yahoo
sci-biology/ants
sci-libs/labbookdb
dev-python/matrix
dev-python/tqdm
sci-biology/psychopy
sci-biology/nilearn
sci-biology/dcmstack
sci-visualization/mricron