After doing two distro upgrades, you may come up with some duplicated packages. Here's where this script came handy:
rpm -qa |
awk -F- '{OFS=FS; if (NF>1) NF-=2; print $0'} |
sort |
uniq -c |
grep -v " 1" |
grep -v gpg-pubkey |
cut -f 2 |
grep -v kernel |
while read x;
do
rpm -q $x |
awk '{if(i)print s; i=1; s=$0}';
done |
xargs rpm -e
Yes, it's a real pipeline!