Issue
Problem Statement
- I would like to identify a package and its description using
rpm -qi ${pkgName}
. cat -n
on the output of (1) will yield me which line on wards description section starts.Ex:- 15th Line in case atom IDE editor in rpm.
I know I can solve the output and formatting part again using this line number as
rpm -qi atom | awk -v n=${lineNum} 'NR>=n'
. HerelineNum
would be 15.
This is inefficient and I would like to use the rpm -qi
command only once and then achieve this extracting out the description section on wards. Does anybody have a way to do this ?
Additional requested input
[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 ~]$
Solution
Instead of combining something, just use rpm
command to query a specific tag. No sed
and fancy stuff needed at all.
rpm -q --queryformat '%{description}' atom
Answered By - Danila Vershinin