有没有办法在单管道命令链中以有效的方式组合以下两个 UNIX 命令?

Ana*_*rni 0 unix awk sed rpm

问题陈述

  1. 我想使用rpm -qi ${pkgName}.
  2. cat -n 在 (1) 的输出中会告诉我病房描述部分的哪一行开始。

    例如:- 第 15 行,以防 rpm 中的 atom IDE 编辑器。

  3. 我知道我可以使用此行号作为 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 ~]$
Run Code Online (Sandbox Code Playgroud)

Dan*_*nin 5

不要组合某些东西,只需使用rpm命令来查询特定标签。sed根本不需要花哨的东西。

rpm -q --queryformat '%{description}' atom
Run Code Online (Sandbox Code Playgroud)