#!/bin/csh

rpm -qa --qf "%{NAME}\n" | sort >/tmp/example.out

foreach i ( `uniq </tmp/example.out | diff - /tmp/example.out | grep \^\> | sed -e 's/^> //'` )
  echo ' '
  echo '-----------------------------'
  echo ' '
  rpm -q $i

  set RPM=`rpm -q $i | head -1`

  if (`echo $RPM | cut -d '-' -f 1` != kernel) then
    echo ' '
    echo -n "Removing " $RPM ": "
    rpm -e --justdb --nodeps $RPM
    set RPM=`rpm -q $i | head -1`
    rpm --verify $RPM
  endif

end
