Hi,
  I'm editing a software(nagios)configuration files
and I thought it would be much easier if I could just
create a perl script to edit such files. Though I have
very little ideas coming on how to accomplish this
task. I need some tips for this one. The config file
format is like this:

define host{
    hostname      www.google.com
    ip            value1
    ...           ...
}
define host{
    hostname      value2
    ip            value2
    ...           ...
}

Its all a series of definitions enclosed with
brackets. Do you know a better solution to parse this
file such that I can edit for example the host entry
www.google.com and set its ip to a different value.

I'm thinking perhaps I could just read the file line
by line and then when it encounters the word
"hostname", look for the word next to it and then if
it is ww.google.com, and then.. that's it. I don't
know what to do next. Can you help me up on this one?
Please. Thanks














__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to