问题陈述
rpm -qi ${pkgName}
识别包装及其说明。cat -n
在(1)的输出上会向我显示病房的哪条线说明部分开始。
例如:-第15行,如果原子IDE编辑器以rpm为单位。
我知道我可以使用该行号再次解决输出和格式化部分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 ~]$
[而不是组合某些东西,只需使用rpm
命令来查询特定标签。完全不需要sed
和花哨的东西。
rpm -q --queryformat '%{description}' atom
您可能想要类似的东西:
rpm -qi atom | sed -ne '/^Description/,$ p'
[我们使用sed
打印匹配行之后的所有内容。但是,正如另一个答案所示,rpm
有一个实现此目标的本地方法。