I have to send all rpm related information to our log analyzer and I am running the command below which give continuous output as follows:
CMD
sudo rpm -qa --info | egrep 'Name|Version|Architecture|Install Date|Vendor|Description'
O/P
Name : openssh-clients
Version : 7.4p1
Architecture: x86_64
Install Date: Fri 29 Nov 2019 02:31:40 PM UTC
Vendor : Amazon Linux
Description :
Name : p11-kit-trust
Version : 0.23.5
Architecture: x86_64
Install Date: Tue 18 Jun 2019 10:23:44 PM UTC
Vendor : Amazon Linux
Description :
Name : ec2-hibinit-agent
Version : 1.0.0
Architecture: noarch
Install Date: Fri 29 Nov 2019 02:31:44 PM UTC
Vendor : Amazon Linux
Description :
Name : python-slip-dbus
Version : 0.4.0
Architecture: noarch
Install Date: Tue 04 Feb 2020 12:41:09 PM UTC
Vendor : Amazon Linux
Description :
I would like to split the above output whenever Name comes. It should be split with a space.
You can format your
rpm
output using--qf
.I took the
egrep
out of your statement and used the formatting.Output
Install the vim-enhanced package if you'd like to use a version of the VIM editor which includes recently added enhancements like interpreters for the Python and Perl scripting languages. You'll also need to install the vim-common package.
Name : wget
Version : 1.14
Architecture: x86_64
Install Date: Tue 29 Oct 2019 02:54:15 PM UTC
Vendor : CentOS
Description : GNU Wget is a file retrieval utility which can use either the HTTP or
FTP protocols. Wget features include the ability to work in the background while you are logged out, recursive retrieval of directories, file name wildcard matching, remote file timestamp storage and comparison, use of Rest with FTP servers and Range with HTTP servers to retrieve files over slow or unstable connections, support for Proxy servers, and configurability.
Note: the formatting looks different in markup than it does on my screen.
Also note the egrep wasn't giving you a description because descriptions start on a new line.
And finally, descriptions can have spaces. This method will capture the full description.
You can see what tags are available using:
References