Remove version numbers from package lists


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove version numbers from package lists
# 1  
Old 12-20-2010
Remove version numbers from package lists

I just upgraded my laptop from Fedora 13 to 14, and normally, before I do the upgrade (Fresh install) I run an rpm command to make a list of all the packages I have installed, but without the version and architectures specified, so that I can just feed that list to yum after the upgrade to reinstall all the packages I had installed "post-install" after my last installation. However, stupid me I forgot to do that this time, I just did a regular "rpm -qa | sort" command, so I have a package list like this:

Quote:
a52dec-0.7.4-15.fc11.i586
aalib-libs-1.4.0-0.18.rc5.fc12.i686
abrt-1.1.14-1.fc13.i686
abrt-addon-ccpp-1.1.14-1.fc13.i686
abrt-addon-kerneloops-1.1.14-1.fc13.i686
abrt-addon-python-1.1.14-1.fc13.i686
Rather than like this:

Quote:
a52dec
aalib-libs
abrt
abrt-addon-ccpp
abrt-addon-kerneloops
abrt-addon-python
I like using the shell, however I am by no means a shell ninja, so I would like to ask, are there any shell ninjas out there, who can think of a command or shell script to strip away version numbers and architectures away from the package list that I got, so that it is merely the package name itself left, as illustrated above.

Thanks a lot in advance! Smilie
# 2  
Old 12-20-2010
Code:
 
rpm -qa | sort | sed -e 's/\([^.]*\).*/\1/' -e 's/\(.*\)-.*/\1/'

This User Gave Thanks to anurag.singh For This Post:
# 3  
Old 12-20-2010
Quote:
Originally Posted by anurag.singh
Code:
 
rpm -qa | sort | sed -e 's/\([^.]*\).*/\1/' -e 's/\(.*\)-.*/\1/'

Fantastic! Thanks a lot, you just saved me a lot of time and headache, I really appreciate it!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to install older package version on Ubuntu 18.04?

Hello, I'm running Ubuntu 18.04 and I would like to install libboost-python version 1.46. Currently I have installed version 1.65: wakatana@local-machine:~$ dpkg -l | grep libboost-python ii libboost-python-dev 1.65.1.0ubuntu1 amd64 ... (1 Reply)
Discussion started by: wakatana
1 Replies

2. Solaris

Check that supersede of package version is installed

I need a programmatic way to check, that supersede of required package is installed. At Linux I do it using rpmvercm utility to compare installed package version to my minimal requirement. So - I need analog of Linux "rpmvercm" utility for Solaris (10/11) Let us say - I know that minimal version... (10 Replies)
Discussion started by: zuismanm
10 Replies

3. Shell Programming and Scripting

Compare two files containing package names and version number

I have 2 files each containing a list of same fedora packages but with different version number. I want to compare the 2 files and remove the lines containing a newer or older version number (1 Reply)
Discussion started by: asya18
1 Replies

4. Shell Programming and Scripting

To delete the common parts (version and suffix) to get the package name

I have lots of package version +suffix full name, but I just want to get the package name, which means delete the common parts eg: dtc-1.3.0+gitAUTOINC+033089f29099bdfd5c2d6986cdb9fd07b16cfde0-r4.1.x86_64.rpm ... (5 Replies)
Discussion started by: yanglei_fage
5 Replies

5. Shell Programming and Scripting

How to sort version numbers?

I would like to know how to sort version numbers, using bash or perl. I would like to sort file names that are program names with version numbers and extensions, such as hello-0.2.3.tar.gz and hello-0.10.3.tar.gz. Version numbers of computer programs do not comply with the mathematical rule... (3 Replies)
Discussion started by: LessNux
3 Replies

6. Emergency UNIX and Linux Support

Problem when trying to remove a package using rpm command - error: package is not installed

Hello, i have installed a package by using the command sudo rpm -i filepackage.rpm package filepackage is already installed when i try to remove it, i get an error saying "is not installed": sudo rpm -e filepackage.rpm error: package filepackage is not installed How can... (4 Replies)
Discussion started by: g_p
4 Replies

7. Linux

How install a new package without remove old package?

Dear all, I would like to install a new version of package without remove old version on Centos and vice versa. Please give me advice! thanks much, (2 Replies)
Discussion started by: all4cfa
2 Replies

8. Shell Programming and Scripting

Package version testing script

I was wondering if anyone already had a script to check rpm packages versions x.x.x or greater. so I could do a: # CheckRpmVersion Somepackage-1.2.3 And would output: whether the package is installed or not and if it was equal to or greater than the version 1.2.3. I know I can pull out... (0 Replies)
Discussion started by: Ikon
0 Replies

9. Debian

Package updated to same version

Hi, I recently did slight modifications to the basename utility from the coreutils package. I downloaded the source by typing "apt-get source coreutils", added a new option to the program, updated the respective manpage, build and installed it using "dpkg-buildpackage -uc -b && dpkg -i... (0 Replies)
Discussion started by: Gunther
0 Replies

10. UNIX for Dummies Questions & Answers

package version

hi, I have this problem. I run a script to check which version of a given package is installed and I need something returning a meaningfull answer also if the installation was done with the sources. Let's say that, a priori, I do not know how the package was installed. So far I have... (0 Replies)
Discussion started by: gcastell
0 Replies
Login or Register to Ask a Question