rpm -q -> 仅查询描述符

rpm -q -> query only the descripton

本文关键字:查询 描述 gt rpm      更新时间:2023-10-16

我可以查询有关

的RPM包装的信息
rpm -qi <rpm-package-name>

查询的示例分子:

tfaa004:/sm/bin # rpm -qi expect-5.45-16.1.3.i586
Name        : expect
Version     : 5.45
Release     : 16.1.3
Architecture: i586
Install Date: Di 27 Jun 2017 15:31:08 CEST
Group       : Development/Languages/Tcl
Size        : 674166
License     : SUSE-Public-Domain
Signature   : RSA/SHA256, Do 25 Sep 2014 11:42:26 CEST, Key ID b88b2fd43dbdc284
Source RPM  : expect-5.45-16.1.3.src.rpm
Build Date  : Do 25 Sep 2014 11:42:16 CEST
Build Host  : cloud120
Relocations : (not relocatable)
Packager    : http://bugs.opensuse.org
Vendor      : openSUSE
URL         : http://expect.nist.gov
Summary     : A Tool for Automating Interactive Programs
Description :
Expect is a tool primarily for automating interactive applications,
such as telnet, ftp, passwd, fsck, rlogin, tip, and more.  Expect
really makes this stuff trivial.  Expect is also useful for testing
these applications.  It is described in many books, articles, papers,
and FAQs.  There is an entire book on it available from O'Reilly.
Distribution: openSUSE 13.2

,但我只想查询描述。那可能吗?原因是我想在C 程序中处理此信息(描述)(我使用Popen())。

也许这样的东西:

rpm -qi -Description expect-5.45-16.1.3.i586

这是正确的扣除:

rpm -q --queryformat '%{DESCRIPTION}n'  expect-5.45-16.1.3.i586

[为opensuse rpm输出编辑]:

rpm -qi package_name |sed'1,/description/d;/distribution/,$ d'

这只会在"描述"之间打印行。和"分销"&quot&quot

[以下CMD适用于RHEL发行版]

我不相信" rpm"实用程序只有一个仅打印出"描述"的标志。字段,但它就像使用管道一样简单:)

您可以做:

rpm -qi openssh-Server-5.3p1-104.el6.x86_64 |awk'/description/,0'

将在模式之后打印每条线。找到。

或,如果您更倾向于使用" grep":

rpm -qi openssh-Server-5.3p1-104.el6.x86_64 |grep -a20'描述'

" -a n&quot"Flag告诉GREP找到图案后打印N线。

***编辑:您也可以使用" sed":

rpm -qi openssh-Server-5.3p1-104.el6.x86_64 |sed -e'1,/description/d'

希望这会有所帮助。