The output format from the command
rpm -qa looks like the following:
abrt-1.1.14-1.fc14.x86_64 abrt-addon-ccpp-1.1.14-1.fc14.x86_64 abrt-addon-kerneloops-1.1.14-1.fc14.x86_64 abrt-addon-python-1.1.14-1.fc14.x86_64 abrt-desktop-1.1.14-1.fc14.x86_64 abrt-gui-1.1.14-1.fc14.x86_64 abrt-libs-1.1.14-1.fc14.x86_64 abrt-plugin-bugzilla-1.1.14-1.fc14.x86_64 abrt-plugin-logger-1.1.14-1.fc14.x86_64 abrt-plugin-runapp-1.1.14-1.fc14.x86_64
Can anyone tell me how to reliably remove the version, release, and arch part so that I end up with
abrt abrt-addon-ccpp abrt-addon-kerneloops abrt-addon-python abrt-desktop abrt-gui abrt-libs abrt-plugin-bugzilla abrt-plugin-logger abrt-plugin-runapp
I would rather avoid trying to construct a regular expression for sed, because I expect it to be complicated in order to support names like super-3d-editor-0.1-1.fc14.x86_64 or similar. I am sure I am not the first person wanting such filtering, therefore I ask here to check if there already exists some solution.
Update: The "or similar" note above implies some knowledge about what rpm package names looks like. Most of them are "nice looking" like the ones presented above, but there are also entries with more diverse numbering schemes:
fxload-2002_04_11-9.fc12.x86_64 GitPython-0.2.0-0.3.beta1.fc14.noarch ModemManager-0.4-4.git20100720.fc14.x86_64 python-peak-rules-0.5a1.dev-12.a1.dev.20100803svn2646.fc14.noarch pytz-2010h-3.fc14.noarch
Also note that there exists packages where a version number is part of the name like
java-1.5.0-gcj-188.8.131.52-34.fc14.x86_64 java-1.6.0-openjdk-184.108.40.206-220.127.116.11.fc14.x86_64 java-1.6.0-openjdk-devel-18.104.22.168-22.214.171.124.fc14.x86_64
and there are even a few where the release/arch is missing (these might be hard to handle, and I can accept failure to handle these)
bouml-doc-4.3.2-3.noarch fedora-release-14-1.noarch glibc-2.12.90-21.i686 basesystem-10.0-3.noarch ivtv-firmware-20080701-20.noarch gpg-pubkey-97a1071f-4c49d6fe
That is why I asked for a reliable way to do this; I knew that creating an approximate sed regex would be possible but it was bound to fail to handle many lines.
(I know that it is possible to format the output from rpm with --queryformat, however that will not be of help to me if I want to compare which packages I have installed today compared with a
rpm -qa listing from a year ago.)