[CentOS] find latest version of rpms from a mirror

Thu Dec 10 11:05:37 UTC 2009
John Doe <jdmls at yahoo.com>

From: john blair <mailtome200420032002 at yahoo.com>
> I want to write a script to find the latest version of rpm of a given package 
> available from a mirror for eg: 
> http://mirror.centos.org/centos/5/os/x86_64/CentOS/
> Is there any existing script that does this? Or can someone give me a general 
> idea on how to go about this?

Example:

  URL='http://mirror.centos.org/centos/5/os/x86_64/CentOS/'
  PKG=...
  links -dump $URL | grep "$URL$PKG-[0-9]" | cut -f2 -d' '

Replace with 'cut -d'/' -f9' if you don't want the full URL...

JD