Text Manipulation Help

I am currently trying to write a script that will take the hostnames
from a webserver directory listing and create nagios configs from that

Everything is in place on the nagios end that all it needs to do it
run this script and im done.
I was thinking of using the hpricot gem in order to parse the web
server directory listing. The listing is of the config files for each
device which is named its hostname.

I also have all the names in a text file if that is easier, it is just
less dynamic.
I will post my progress as well. Eventually I might turn this into a
RESTful app that can be run via the web but thats Version 2.0