问题陈述
rpm -qi ${pkgName}
来识别包装及其说明。 cat -n
将向我显示病房中的哪一行
说明部分开始。
Ex:-第15行,以rpm为单位的原子IDE编辑器。
我知道我可以使用该行号再次解决输出和格式化部分
rpm -qi atom | awk -v n=${lineNum} 'NR>=n'
。这里lineNum
为15。
这效率低下,我只想使用rpm -qi
命令一次,然后将其提取出来,以实现对病房的描述。有人有办法吗?
其他要求的输入
[anand@ldnpsr2937 ~]$rpm -qi atom
Name. : atom
Version : 1.42.0
Release : 0.1
Architecture: x86_64
Install Date: Sun 12 Jan 2020 10:23:12 AM
Group : Unspecified
Size : 590646918
License : MIT
Signature : (none)
Source RPM : atom-1.42.0-0.1.src.rpm
Build Date : Sat 14 Dec 2019 03:38:56 AM
Build Host : 2580f855e2eb
Relocations : /usr
URL : https://atom.io/
Summary : A hackable text editor for the 21st Century.
Description :
A hackable text editor for the 21st Century.
[anand@ldnpsr2937 ~]$
答案 0 :(得分:5)
使用rpm
命令来查询特定标签,而不是组合某些内容。根本不需要sed
和花哨的东西。
rpm -q --queryformat '%{description}' atom
答案 1 :(得分:1)
您可能想要类似的东西:
rpm -qi atom | sed -ne '/^Description/,$ p'
我们使用sed
在匹配行之后打印所有内容的位置。但是,正如另一个答案所示,rpm
有一种实现此目标的本地方法。